PDA

Click to See Complete Forum and Search --> : C programmer lost Focus


Rick H
Jan 6th, 2000, 03:16 PM
The transistion for a "concieved to be" hard lanuage like C to one like Basic is harder than I thought!

I am a bit confused by where the "focus" of the program is at any given moment. In C from when I start i.e

void main(void)
{
do this
then do this
then wait here untill event X happens
}

I always know where the program is and what its doing.

One of my main questions is where does the program start from? As far as I can tell the program "starts" in the Private Sub Form_Load() of my main form.

From here I am calling my functions as if this was main(void) in C. Is this the right thing to do?

Thanks

Crazy D
Jan 6th, 2000, 03:45 PM
Hehe post this on some C newsgroups too to show VB isn't that easy as they always think *LOL*
but anyway, depends on what functions you want to perform.
Something happens in VB when the event is raised, eg., you want to save a file with info the user just typed, you usually put that code in a command_click event (cmdSave would be an obvious name).
In other cases, where the program "just has to do certain tasks", I think the form_load is a good place to put them. At least, you always put initialization code in there.
Or, drop a command button (cmdStart) on the form, and let the user click on that button when they want to start the task.
If you want more info, be some more specific about what your program is supposed to do.

KENNNY
Jan 6th, 2000, 05:26 PM
basically, in vb the message handling is done for you :)
In that way VB is kinda like MFC, in that it maps messages to events (command1_click). The good thing about vb, though, is that if u want you can send messages and handle messages yourself, if you need to do something very specific.
You can start your app at form_load or at
Sub Main - go to project settings to change it. Sub main is good if your have a lot of forms, some which you may not want to load at startup.

------------------
cintel rules :p
www.cintelsoftware.co.uk