Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
  • *Experts*
Posted

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

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Posted

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

www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
  • Administrators
Posted

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.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

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.

www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Posted

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.

www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...