Better solution for Click event
Hi,
I have the following issue and I was wondering if there is a better solution for it.
On my window I have a button, after pressing the button the main program starts rs-232 communication. The window is a listerner for a status object that is filled by the class that handles the rs-232. The window does not update until the communication is done. the events are generated, I check. what I think is the problem pressing the button is blocking for the window to update. (cause the events are there).
My solution: when pressing the button, start a timer(100 mS) and then perform the task. this works fine, but I was wondering if there is a better solution?
in VB a simple DoEvent would do the trick :)
thx for the reaction,
Jewe
[783 byte] By [
Jewe] at [2007-11-19 6:38:51]

# 2 Re: Better solution for Click event
in VB a simple DoEvent would do the trick :)
yes, but VB doesnt support the notion of multi-threading without some seriously complicated pitfalls. In java we would give this task to a separate thread, but if you come from a VB background, do read up on multithreading first (to a good extent) because its something you are unlikely to have come across or managed (if your background is purely VB)
also, note that VB is intended to be a rapid development language, with a lot of convenience features and a great number of inconsistencies. I've seen some very sloppy vb coding which lead me to consider that many VB programmers are quite lazy about the code they write. I dont mean this as a derogation, merely a caution that java requires much more hard work than VB because it isnt so "thrown together with convenience in mind". (Sorry)
cjard at 2007-11-10 2:25:32 >

# 3 Re: Better solution for Click event
Joe Nellis and Cjard thank you both for the reply.
any good tips of which articals to read?
I agree with the fact that VB does allow you to program poorly.
but which programming tools does not?
That's the reason I posted.. :)
later,
Jewe
Jewe at 2007-11-10 2:26:31 >

# 5 Re: Better solution for Click event
Joe Nellis and Cjard thank you both for the reply.
any good tips of which articals to read?
I agree with the fact that VB does allow you to program poorly.
but which programming tools does not?
oh, of course.. all progrmming languages have scope for making a real dog's dinner of things, but VB more so than most, i see, because of the huge number of conveniences it offers; if you need a variable, you just write the name without needing to declare it. if youre doing string concatenation you can use & or +, but they do behave differently, there are shortcuts for common types, the looping structures have no fine grained control..
it's very... basic?
kinda like Mac OS; it doesnt lend itself to power applications, because it doesnt generally have power users. that's not to say that every vb program is noddy art, just that the better examples of poorly structured, ill thought out code, are found in vb
cjard at 2007-11-10 2:28:33 >
