Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 5th, 2005, 04:27 PM
Registered User
Join Date: Feb 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Fearghal
Default 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[7];
      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 )
       catch(SocketException se)
    MessageBox.Show (se.Message );
    questionParts = szData.Split(',');

    MessageBox.Show (questionParts[2].Substring(0,5));
    if(questionParts[2].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
// labels


    correctAnswer = questionParts[7];

Any help on this matter would be much appreciated, thank you.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Needed: Updating & Saving Database OnceANewbie BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 0 November 30th, 2008 10:05 PM
Updating Field in Form cthibault Access 2 January 8th, 2008 03:37 PM
Updating Excel with Form fields nancy Classic ASP Professional 6 April 7th, 2006 02:18 PM
Freezing Column and Header in DataGrid Control pramesh_it ASP.NET 1.0 and 1.1 Basics 0 April 3rd, 2006 05:54 AM
Refresh form while updating linked form mfletch Access 0 February 26th, 2004 10:32 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.