4 Replies - 5690 Views - Last Post: 14 July 2009 - 02:58 PM Rate Topic: -----

#1 oXiDee  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 24-June 09

Using the "Invoke" method from another form.

Posted 14 July 2009 - 05:29 AM

Hi Guys,

I've run into a bit of a problem.. I am unsure as to how many people know how "IRC" Servers work here but basically, i'll explain

We are re-creating an IRC Client we made for our Chat site in VB.NET originally vb6

We have serveral different forms but the main problme we are having at the moment is

FrmMain is where you login to the servers, it grabs your data from our MySQL database such as "Nick, Gender, Font" etc. Then proceeds with connection to IRC server on Raw 001 we know the connection to the IRC server has been established... so therefore we open up FrmAuth which in this case they can see roomlist etc. We are unable to get FrmAuth to load probably.

We originally had this working opening up FrmAuth before the connection to IRC server has been established.. This really is no good for us causes alot of errors etc.

So when we use just simply "me.show()" the form loads but freezes we tried doing

 Me.Invoke(New Del(AddressOf me.show)) 

however, this didnt work in which I assume that is because the "FrmAuth" hasn't yet loaded the GUI thread therefore there is no Thread to invoke so we tried

 FrmMain.Invoke(New Del(AddressOf me.show)) 


This didn't work either i assume you cannot access another forms Invoke method..??
we are receiving the error A first chance exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll which i assume has something to do with it but not quite sure..

So my question comes down to the fact of, how do we open up FrmAuth without it freezing? Is there a way to access the invoke method on another form?


Thank you

Is This A Good Question/Topic? 0
  • +

Replies To: Using the "Invoke" method from another form.

#2 T3hC13h  Icon User is offline

  • D.I.C Regular

Reputation: 65
  • View blog
  • Posts: 337
  • Joined: 05-February 08

Re: Using the "Invoke" method from another form.

Posted 14 July 2009 - 07:29 AM

ShowDialog wont work for your purposes?
Was This Post Helpful? 0
  • +
  • -

#3 oXiDee  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 24-June 09

Re: Using the "Invoke" method from another form.

Posted 14 July 2009 - 02:42 PM

Hi,

No showdialog wont work... I believe showdialog stops the thread completly and opens up, I am unable to use.

We're we detect case 001 is actually on frmAuth so this wont work because on once FrmMain logs in to our servers checks the User/Password it then proceeds to connecting to the IRC Server using

FrmAuth.ConnectToServer("Address", Port) therefore we have told the App to Connect to the IRC server however we have not told it to show frmAuth yet.
When we receive RAW 001 from the IRC server thats when we want FrmAuth to show.. If i use a simple Me.Show() method the form opens but freezes right there.


Thanks
Was This Post Helpful? 0
  • +
  • -

#4 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1162
  • View blog
  • Posts: 4,444
  • Joined: 02-July 08

Re: Using the "Invoke" method from another form.

Posted 14 July 2009 - 02:52 PM

Is there something in the frmMain's Load event that may be freezing it up? Can you show more code as to how you load the forms?
Was This Post Helpful? 0
  • +
  • -

#5 LoveIsNull  Icon User is offline

  • Recovering D.I.C Addict
  • member icon

Reputation: 52
  • View blog
  • Posts: 646
  • Joined: 10-March 09

Re: Using the "Invoke" method from another form.

Posted 14 July 2009 - 02:58 PM

I don't get it, looks like you are invoking the Show() method of a form that is already visible.

Me = current object. In your case the current form, so the form is telling itself to show. Unless this form started hidden, I don't see the logic. In that case you could use Me.Visible = True.

This post has been edited by LoveIsNull: 14 July 2009 - 03:00 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1