An unhandled exception

mmepeg

New member
Joined
Oct 2, 2005
Messages
1
Programming Experience
1-3
Hi everyone,

I am trying to create a client/server interaction via Stream Socket connection and when I run and compile the server side code I have the following message:

An unhandled exception of type 'System.NullReferenceException' occurred in MyProject.exe

Additional information: Object reference not set to an instance of an object.


I have Attached the code down there.
Can anyone help me as I am a beginner with VB.NET
Many Thanks Peg.
View attachment Server.doc
 
The problem is that you never instantiated txtDisplay. You declared it as a TextBox, but never created an instance of it. You should either draw it on your form or include something like the following in your Load or New method:

txtDisplay = new TextBox()
txtDisplay.Location = new Point(100,100) 'Wherever you want to place it
me.Controls.Add(txtDisplay) 'Add it to the form's control collection
 
Back
Top