PDA

View Full Version here: : Are there any Visual Basic programmers out there?


thunderchildobs
08-06-2009, 09:58 PM
Are there any Visual Basic programmers out there?

I am looking for some help on threads and GUIs.

Brendan

sheeny
09-06-2009, 07:12 AM
I play about with VB.NET 2005 when I have a project to do. I wouldn't say I'm particularly experienced with threads and GUIs though, but that's never stopped me.:P

Al.

thunderchildobs
09-06-2009, 12:23 PM
I am trying to do the following.

I have menu item that opens a window with "Start", "Pause", "Abort" buttons, and a text box.

On clicking "Start" the program does the following

AbortOperation = false
I = 1
Loop
I = I + 1
Display I into the text box
Until I > 10000 or AbortOperation = True
End

On clcking the "Abort" button
AbortOperation = true
Display "Aborted"" in the textbox
end

The idea being that Abort Button is to stop the processing.
If I click "Abort" nothing happens immediatley,
but the "Aborted" message is displayed when the loop finished.

It seems the Abort click is being queue somewhere and not imediataley interrupting the loop.

Any suggestions.

I am using VB 2005.

thanks

sadia
09-06-2009, 12:49 PM
You need to make the application multithread compatible. Its gonna be kinda long if I explain it here so i would suggest you google on Multithreading for VB.NET or read any similar article like the following http://www.devx.com/DevX/10MinuteSolution/20365

vaztr
09-06-2009, 01:38 PM
You could also try a 'DoEvents' anywhere within your loop - this basically tells your loop to check whats going on with the rest of the PC before continuing on - sort of lets it 'take a breath'. VB loops always seem to hog the processor!!

thunderchildobs
09-06-2009, 07:08 PM
Thanks for the info.

Vaztr, the DoEvents was answer I was looking for.

Brendan