Drstein99 Posted November 17, 2004 Posted November 17, 2004 Does anyone have an idea why my program will hang when I call groupbox.hide? It's VISIBLE=FALSE upon program load and I do this, at some point (my groupbox is called gbSnag); gbSnag.Show() gbSnag.Update() -- later in the program it will; If gbSnag.Visible Then gbsnag.hide ' <<---- the program just halts idle here endif ----------- This is a rediculous hang-up for me will someone please help? thanks. Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
*Experts* DiverDan Posted November 18, 2004 *Experts* Posted November 18, 2004 Try not using hide and show, rather Visible = True or False. That will probably solve the hanging problem. If gbSang.Visible Then gbSnag.Visible = False Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
Drstein99 Posted November 18, 2004 Author Posted November 18, 2004 The program will lock when; .enabled=false .visible=false ------ I've also devised some type of code, after researching help documents - aparently the "show" or other process had been created on a separate thread of the program, and it seems to be halting for threading purposes. gbSnag.InvokeRequired According to the help documents, when this = true, threading is involved I must use some type of invokeing to accomplish what I need. So I made this code; Delegate Sub dstest() ' furthur down the program in my hide "button-click" event Dim es2 As dstest = AddressOf gbSnag.Hide gbSnag.Invoke(es2) ----------------------- After the INVOKE command, the next line of code will cause the program AGAIN to hang in place. So this is also not working as well. I can't believe I am having so much trouble over something as simple as hideing and showing a group-box. This is so simple. I feel because in my past life, I have lied - cheated, stolen, and committed sin - GOD is punnishing me now and causing a form of dismay to what in the past has always been a simple operation of .hide and .show Thanks Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Administrators PlausiblyDamp Posted November 18, 2004 Administrators Posted November 18, 2004 The bottom line in .Net is that you shouldn't be modifying the UI from anything other than the primary thread, if you are then you need to invoke the changes from the main thread. Could you post more of the code as trying to figure out multi-threaded problems can be difficult at best of times, never mind when you only have tiny snippets of code to work with. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Drstein99 Posted November 18, 2004 Author Posted November 18, 2004 Thats what I can't understand myself. All this code that is executed on the main form class. The HIDE command is being triggered by a button click. -BUT my SHOW command, is being triggered from an "addhandler" event from a threadding object. When a new TCP/IP listener connection is made, it triggers this event and WILL SHOW this group-box. The application is lengthy and complicated. As this is my first project working with threading and tcp/ip- I have been a versed database programmer for many ongoing years in the past. Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Drstein99 Posted November 18, 2004 Author Posted November 18, 2004 Ok - I believe I've resolved this issue. Here's what I had to do; On my threading events, I addhandler and removehandler like this; AddHandler laThread.addhand, AddressOf Me.OnLineReceived -instead of AddHandler laThread.addhand, AddressOf OnLineReceived ---- Next, on my SHOW command, that appears to be executing as a process of that thread - I will do; Delegate Sub dstest() 'in the main form is delcared, then in the function--- Dim es2 As dstest = AddressOf gbSnag.Show gbSnag.Invoke(es2) - in the sub to HIDE that box I do; Dim es2 As dstest = AddressOf gbSnag.hide gbSnag.Invoke(es2) --------------------------------------- The program appears to run without flaw now. There are so many fascets involved with threading etc.... I can't understand them all at once, so I just do the best. When I see the program appears to operate safely, I just keep on "trucking" until another problem presents itself. ---- Thanks for the support, your suggestions, influence, and remarks are totally welcomed and I appreciate your time. Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.