Please login or register.

Login with username, password and session length
Advanced search  

News:

The Buster PiX10Hub is here! Created by the Community, for the Community.:)% #:)

Pages: 1 [2]

Author Topic: VB example questions  (Read 36747 times)

EL34

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Re: VB example questions
« Reply #15 on: March 31, 2008, 10:11:20 AM »

Hey Bill, the Timer function doc say it is only good up to 65,000 or so ticks which is just over a minute.

I tested it and it won't time for very long.
I'll have to count ticks myself or something in order to get longer timer periods

The ApplicationExit docs are a bit sketchy and don't clearly show how to use it with a win form

The exit code below works, I am just wondering if it is exiting the simple form with one button cleanly and not leaving any tidbits behind in Windows OS?

Is this the correct way to use it in Win forms?

Code: [Select]
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Application.Exit()
    End Sub
End Class


Thanks again for the help.
« Last Edit: March 31, 2008, 10:54:33 AM by EL34 »
Logged
W10 - CM15A - AHP 3.301 - i Witness - MyHouse online - Smart Macros - SDK using Visual Basic express 2008
My X10 page-> http://www.el34world.com/Misc/home/X10_0.htm

-Bill- (of wgjohns.com)

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 81
  • Posts: 1340
  • He's just this guy. You know?
    • wgjohns.com
Re: VB example questions
« Reply #16 on: March 31, 2008, 11:52:48 PM »

Hey Bill, the Timer function doc say it is only good up to 65,000 or so ticks which is just over a minute.

I tested it and it won't time for very long.
I'll have to count ticks myself or something in order to get longer timer periods

Exactly!
By handling the timer control's "Tick" event...
Code: [Select]
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ... commands to execute each tick ...
    End Sub
You can have your program count "ticks" and act appropriately.  This is advantagous because it doesn't cause the program to "lock up" while it is waiting.

If you do use the timer, remember to add to your Main Form loading event:
Code: [Select]
        ' Initialize the timer
        Timer1.Enabled = True

The ApplicationExit docs are a bit sketchy and don't clearly show how to use it with a win form

The exit code below works, I am just wondering if it is exiting the simple form with one button cleanly and not leaving any tidbits behind in Windows OS?

Is this the correct way to use it in Win forms?

Code: [Select]
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Application.Exit()
    End Sub
End Class


No guarantees.  However that is basically the way I use it too.
« Last Edit: March 31, 2008, 11:56:16 PM by -Bill- (of wgjohns.com) »
Logged
-Bill- (of wgjohns.com)
bill@wgjohns.com

In the real world, the only constant is change.

When I'm online you can find me in the Home Automation Chat Room!

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 271
  • Posts: 10016
  • I don't work for X10, I use it successfuly!
    • Tuicemen Forum
Re: VB example questions
« Reply #17 on: April 03, 2008, 09:05:20 AM »

-Bill- (of wgjohns.com): thanks for jumping in, I figured you would  while I was away! ;)

EL34: With VB you'll find there is usually more then one way of doing something!
Use the How do I help to find examples for code your looking for (usualy it doesn't work %100 the way you want but it gives you ideas)! ;)
Another way you can do your timer is the use current time "+" (I don't have the code but it should get you thinking) ;)
If you wish just to exit a sub the command is "exit sub" this doesn't exit the program just the sub!
Hope this helps! ;)
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

Find extra info @ My forum

EL34

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Re: VB example questions
« Reply #18 on: April 03, 2008, 09:28:51 AM »

Thanks Tuiceman

I have written 3 windows form VB programs in the last 3 day. All off them are using the app(exit), no problems yet so it looks good so far ;D

The timer thing was easy.
I have the timer count to 60,000, which is one minute
On the timer event I add 1 to the TotalTime variable every the time evert is triggered.
TotalTime variable is the number of minutes the program has been running and so I just do a If Then on the TotalTime variable to see if it's time to exit the app.

I have been using the help and how do I ever time I need to translate a perl command to vb
They have examples but not all of them are exactly like you need.

for example, I needed to dim and fill an array with 16 values. All the array helps and how do I's did not show this clearly.
I ended up searching on the web and found a post somewhere that showed it using the curly braces like this { a,b,c,d,etc}

a bit of history just so you guys don't think I'm a toal idiot.  ;D
I have been programming since 1978 and so I know what I need to do in my head, it's just a matter of figuring out how it is done in VB.
I started on a commador pet, you know the ones that had a cassette to load programs and the keyboard and screen were all one piece.
After that I programmed commador business machines for quite a while.
Took some IBM 360 assembly languege courses in about 1980 and did some assembly.
went to gw basic sometime in the 80's
gave up programming all through the 90's
learned perl in 2001 because my business shopping cart is written in perl

I still write cgi shopping cart interfaces, web forms in perl and until recently, x10 home automation programs.
Wrote a big program in perl that integrates Quickbooks into my shopping cart using the Quickbooks SDK
All my orders import from the web to my local quickbooks machine, no hand punching data

The reason I am now using VB express is because it's way easier to write windows programs in Vb than it is in perl

Long winded post but just want to say thanks to Bill and you for the VB help
Logged
W10 - CM15A - AHP 3.301 - i Witness - MyHouse online - Smart Macros - SDK using Visual Basic express 2008
My X10 page-> http://www.el34world.com/Misc/home/X10_0.htm

-Bill- (of wgjohns.com)

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 81
  • Posts: 1340
  • He's just this guy. You know?
    • wgjohns.com
Re: VB example questions
« Reply #19 on: April 03, 2008, 10:50:40 PM »

-Bill- (of wgjohns.com): thanks for jumping in, I figured you would  while I was away! ;)

You're welcome... I think?   ;)   ;D


EL34,

Been down nearly identical roads and chose VB for the very same reasons myself!

Beware, I may hit you up for pearl scripting advice someday!  ;)
Logged
-Bill- (of wgjohns.com)
bill@wgjohns.com

In the real world, the only constant is change.

When I'm online you can find me in the Home Automation Chat Room!

EL34

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Re: VB example questions
« Reply #20 on: April 04, 2008, 10:29:25 AM »

I'll do what I can.  ;D
I'm no expert on perl either.
Basically my approach to programming is that when I need to do something, I figure out the commands it takes to do it, write the app and then I am on to the next project.
The next project can mean any one of 10 different hobbies I have.  :D

A serious perl programmer would laugh at the way I code my apps.
I always write in a real simple to understand format with plenty of remarks.
A year from now when I have to go back and alter a program, I can understand what I did better if I keep it simple.

A real perl programmer would reduce my code down to nothing but a bunch of nested symbols that would be impossible for me to read.  ;D
Logged
W10 - CM15A - AHP 3.301 - i Witness - MyHouse online - Smart Macros - SDK using Visual Basic express 2008
My X10 page-> http://www.el34world.com/Misc/home/X10_0.htm

EL34

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Re: VB example questions
« Reply #21 on: April 07, 2008, 09:12:48 PM »

well, allot has happened since I downloaded VB 2008 express and got the excellent help from Tuice and Bill

Have written several small windows apps , but I now have combined them all into my X10 monitor program
It monitors X10 traffic
It is tied in with my non X10 motion detectors and can turn on light and sirens, etc
It turns on my kitchen lights and coffee when I hit a keychain button while still in bed
It does several other subroutine type things when something is triggered

I just finished hooking into my one wire weather network. My app now monitors several DS18S20 temp sensors in my green house.
I am about to write more code that makes decisions on when to turn on exhaust fans, water circulating pumps, etc in the greenhouse, based on temp sensor readings from the one wire network. I have a solar hot water panel and tank in the green house that stores hot water and then circulates it at night to keep plants warm.

here's a current screen shot, got lots more to do.

Logged
W10 - CM15A - AHP 3.301 - i Witness - MyHouse online - Smart Macros - SDK using Visual Basic express 2008
My X10 page-> http://www.el34world.com/Misc/home/X10_0.htm

-Bill- (of wgjohns.com)

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 81
  • Posts: 1340
  • He's just this guy. You know?
    • wgjohns.com
Re: VB example questions
« Reply #22 on: April 08, 2008, 01:24:35 AM »

EL34,

Looks like you've been busy!

Cool!   8)
Logged
-Bill- (of wgjohns.com)
bill@wgjohns.com

In the real world, the only constant is change.

When I'm online you can find me in the Home Automation Chat Room!

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 271
  • Posts: 10016
  • I don't work for X10, I use it successfuly!
    • Tuicemen Forum
Re: VB example questions
« Reply #23 on: April 08, 2008, 07:45:44 AM »

Nice Job EL34
Sounds and looks cool! ;)
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

Find extra info @ My forum

ebpDoug

  • Newbie
  • Helpful Post Rating: 8
  • Posts: 3
Re: VB example questions
« Reply #24 on: April 01, 2010, 10:17:55 PM »

removed
« Last Edit: August 13, 2010, 06:59:29 PM by ebpDoug »
Logged
Pages: 1 [2]
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.