HELP: form freezing on updating UI, invoke needed?
I am working on a c# compact framework app which communicates with a windows app running on a windows xp machine. I have run into a problem and can't see the error.
On logging in on the client app, on a paocket pc, the server sends back data indicating wether the client app logged in correctly or incorectly. On logging in correctly the client app calls a method which updates the UI, hiding the login UI controls such as textboxes, labels and buttons, and showing the next screen controls which consist of 5 textboxes, 4 labels, 4 radiobuttons. On doing this the client app freezes (when run on a windows XP without emulator), if i run it on a PPC emulator it gives tells me "a managed IndexOutOfRange exception occurred at OnDataReceived + 0xf6 ..."
I feel i may need to use Control.Invoke but dont know how to go about this. Below is a segment of my code where the problem lies.
public void OnDataReceived(IAsyncResult asyn)
string  questionParts = new string;
for(int i=0; i<7; ++i)
questionParts[i] = "";
SocketPacket theSockId = (SocketPacket)asyn.AsyncState ;
int iRx = theSockId.thisSocket.EndReceive (asyn);
char chars = new char[iRx + 1];
System.Text.Decoder d = System.Text.Encoding.UTF8.GetDecoder();
int charLen = d.GetChars(theSockId.dataBuffer, 0, iRx, chars, 0);
szData = new System.String(chars);
catch (ObjectDisposedException )
MessageBox.Show (se.Message );
questionParts = szData.Split(',');
if(questionParts.Substring(0,5) == "Hello")
// This is where the app hangs, when it calls this method which
// consists only of hiding and showing textboxes, radiobuttons and
correctAnswer = questionParts;
Any help on this matter would be much appreciated, thank you.