473,473 Members | 2,015 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Forms Won't Load? Please Help! (Using IAsyncResult)

2 New Member
I am basically writing a server/client application. The client application starts on the login in form where the user is required to enter a user name and password. These are encrypted sent to the server which the server checks against know users. If the user has enter the correct information the server sends back the code <LIGO> which is telling the client software that the login is good. At this point the client software should change to the main form (frmMain) and the login form (frmLogin) should be hidden. However, when frmMain is loaded, it hangs. If you put your mouse of it, it is an hour glass, and if you click on the form the caption will change to "(Not Responding)." On top of this, the login form does not hide. This is the code that is supposed to change the forms (which I currently have in a module)
Expand|Select|Wrap|Line Numbers
  1. Private Sub winsock_DataReceived(ByVal sender As TCPConnection, ByVal Data As String, ByVal BytesReceived As Long) Handles winsock.DataReceived
  2.         If InStr(Data, "<PUPA>") > 0 Then
  3.             SetServerKey(Data)
  4.             CreateLoginInformation()
  5.         ElseIf InStr(Data, "<LIGO>") Then
  6.             frmMain.Show()
  7.             frmLogin.Hide()
  8.         End If
  9.     End Sub
  10.  
If I step through the code, right after this sub is finished it goes to this sub:

Expand|Select|Wrap|Line Numbers
  1. Private Sub BuildString(ByVal Bytes() As Byte, ByVal offset As Integer, ByVal count As Integer)
  2.         Dim intIndex As Integer
  3.         Dim txt As String
  4.         'Console.WriteLine("BuildString")
  5.         m_State = 2
  6.  
  7.         objText = New StringBuilder()
  8.         For intIndex = offset To offset + count - 1
  9.             txt = ChrW(Bytes(intIndex))
  10.             objText.Append(txt)
  11.         Next
  12.         RaiseEvent DataReceived(Me, objText.ToString, objText.Length)
  13.         m_State = 1
  14.     End Sub
  15.  
and then to this:

Expand|Select|Wrap|Line Numbers
  1.  Private Sub Receive(ByVal ar As IAsyncResult)
  2.         ' Start the data receiving process 
  3.         Dim intCount As Integer
  4.         Console.WriteLine("Received")
  5.         Try
  6.             SyncLock objClient.GetStream
  7.                 intCount = objClient.GetStream.EndRead(ar)
  8.             End SyncLock
  9.             If intCount < 1 Then
  10.                 RaiseEvent Disconnected(Me)
  11.                 m_State = 0
  12.                 Exit Sub
  13.             End If
  14.  
  15.             BuildString(arData, 0, intCount)
  16.             SyncLock objClient.GetStream
  17.                 objClient.GetStream.BeginRead(arData, 0, 1024, AddressOf Receive, Nothing)
  18.             End SyncLock
  19.         Catch e As Exception
  20.             RaiseEvent SockError(e.Message.ToString)
  21.             RaiseEvent Disconnected(Me)
  22.             m_State = 0
  23.         End Try
  24.  
Does anyone have any ideas? Everything else up to this point works fine. It just won't switch forms. Thanks in advanced.
Oct 5 '06 #1
0 1208

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Wayne Wengert | last post by:
In VB6 I used to use frmForm1.Show to make a form visible to the user and then use Unload frmForm1 to unload it. I have an app in which I need to "load" and "unload" forms based on user actions....
2
by: yagish | last post by:
Hi Techies, Am really new with the Oracle 9i Forms and am searching for a way to perform Load Balancing in Oracle 9i Forms Application. Its not a J2EE application, so cannot go the OC4J way. I...
7
by: Stingray5678 | last post by:
This should be an easy questions, but I have not had any luck with the answer. Can you load all forms in a project at once and just have the visible = False for all but one??? Then to switch...
2
by: Rob | last post by:
I was working on a project and everything was going fine, then all of a sudden the form set as my startup object stopped loading. I tried setting some others as the startup object, and some of my...
7
by: Sergey Poberezovskiy | last post by:
Hi, I created two base forms: frmList and frmDetail, compiled them into a dll, and then want to use in my new project. The problem: When I created new inherited form, say frmClients, I cannot...
10
by: morangolds | last post by:
Hi, I've been having a problem with C++ Windows Forms apps not "ending" when you close the form window. I've searched about this problem all over the place and most searches have lead me to...
23
by: mosesdinakaran | last post by:
Hi All, I need a small clarification in submitting the forms, Ur suggestions please. In a page I have two form and also two submit butons. (ie)
0
by: RivaCom | last post by:
I have a Database with about 700 entries in it. I'm looking for a few things. Is there a way to create a table for just the Forms that load on startup and only allow access to the forms? Then...
8
by: hoofbeats95 | last post by:
I don't think this should be this complicated, but I can't figure it out. I've worked with C# for several years now, but in a web environment, not with windows form. I have a form with a query...
4
by: kyvl | last post by:
Hi All, I have a problem. Screens won't load. Example ( When I select Games on MSN, it will load the page, but not all the graphics or the buttons to make selections will load. When screens will...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.