473,480 Members | 2,840 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Theading success (and a little gotcha lurking...)

I am so happy about this I had to tell someone and since no one at the
house even knows how to spell VB, I just had to make a short post.

I finally got my little program to correctly do a second thread for the
daily FTP upload. Not doing so was locking up the UI and causing it to
go white-screen. It is also not taking more than 60 seconds and the
timer was popping (yes, I know it is stoppable).

AND, I had to update a status (label) box and that took putting in the
second bit of code and there was a gotcha in there but I got it working,
finally. The update code was a little more complex than just blasting
the text in the box. It queues up messages if one was already showing
and put in a notice to click for more messages. Too cute!

Here's the gotcha in the thread-side UI update of the label text.

I had several forms and a module (quite standard). I put the code in
the module to accept the text destined for the label and called it with
the proper use of a delegate. It did not work. Why? Don't know but
the connection did not work when using the following (not sure which one
failed but I think it was the first line):

formname.lblStatus.InvokeRequired
Dim newDelegate As New UIDelegate(AddressOf StatusAdd)
formname.lblStatus.Invoke(newDelegate)

The following works in the label-owning form:

If lblStatus.InvokeRequired Then
Dim newDelegate As New UIDelegate(AddressOf StatusAdd)
lblStatus.Invoke(newDelegate)
Else

Since the routine was called from more than one form, it was natural to
have it in the module but it just did not work there. It seems the
routine and test has to be in the form which owns the label. So I moved
the routine to the owning module and prefaced the calls to it from the
other form(s) with the form name. Don't ask me! I know it cost some
time because I did not know where the problem really was.

HOORAY!!!

Silly note. I had the "chance" to go back to the VB6 IDE the other day.
I am amazed at how FAST I have gotten used to using the new IDE and how
clunky the VB6 one feels now. With all its problems, it is still
better. Now, if FIND would just FIND inside visually collapsed code...
Why the designers thought that you would not want to find stuff because
you were saving screen space is a continuing mystery!

Mike

Jun 27 '08 #1
0 964

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

303
17409
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
32
1740
by: Lyle Fairfield | last post by:
1. Will your next operating system be Windows? 2. Will your next browser be Internet Explorer? 3. Will your next office suite be MS Office XXXX? 4. Will your next e-mail client be Outlook or...
2
1160
by: Guadala Harry | last post by:
I'm dynamically building an HTML <table> that has a bunch of rows - each of which presents read-only data in DIVs. Just wondering if it's okay to omit both the Name and Id attribute of the DIV...
43
3321
by: Tim Chase | last post by:
Just as a pedantic exercise to try and understand Python a bit better, I decided to try to make a generator or class that would allow me to unpack an arbitrary number of calculatible values. In...
0
7055
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7060
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6760
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7022
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4501
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3013
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.