Object reference not set to an instance of an object

G

Guest

Hello

I am writing an application with VS 2003 VB.Net. I am getting the error
message "Object reference not set to an instance of an object" in the design
environment when trying to view a form in design mode.

I have traced when this happens but I can not figure out why it happens.

I have an MDI form which declares a variable as follows:

Private WithEvents m_C_EvaluationStatus As EvaluationStatus

Where EvaluationStatus is a class. Within my MDI form i have a procedure to
capture an event fired within the class as follows:

Private Sub m_C_EvaluationStatus_EvaluationRequest(ByVal EvaluationID As
Long) Handles m_C_EvaluationStatus.EvaluationRequest

.. Code to process event

End Sub

I get the error message when ever I have this procedure within the MDI form
and can no longer view the MDI form in design mode. If I comment out the
"Handles m_C_EvaluationStatus.EvaluationRequest", then everything is back to
normal in design environment, but no longer processing event at run time.

Can anyone tell me why I am getting the error message "Object reference not
set to an instance of an object"?

Thanks in advance.
Tom

(e-mail address removed)
 
C

Claes Bergefall

You're probably doing something in your event handler that
doesn't work in design mode. Since you didn't post the code
I can't help you very much. Try using the DesignMode
property to wrap the code

/claes
 
G

Guest

Claes

I did not post the code within the procedure cause I currently have it all
commented out. I get the error message just the following in my code:

Private Sub m_C_EvaluationStatus_EvaluationRequest(ByVal EvaluationID As
Long) Handles m_C_EvaluationStatus.EvaluationRequest

End Sub

Which is the cause of my confusion. I select the object from the dropdown
on the left and then the event from the dropdown on the right. The above
code appears as it should, but then I can no longer view the design of my MDI
form until I place a comment before "Handles".

It is really really strange.

Hope this sheds a little more light on the problem I am experiencing.

Tom

(e-mail address removed)
 
B

Bruce Wood

What Claes was saying was that rather than commenting out the offending
bit of code, you may have to add a test for the DesignMode property at
the beginning of some of your methods, and return if DesignMode is
true.

The designer tries to instantiate an instance of your form at design
time, and some of the events fire as a result, even though the rest of
your system is not set up properly. This can cause errors at design
time. The usual solution is to test the DesignTime property and either
skip some processing or just return from the offending routine without
doing anything.
 
C

Claes Bergefall

That sounds really strange. Try debugging the design time
environment:

1. Start a new instance of Dev Studio
2. Select "Debug Processes..." on the Tools menu
3. Select the previously running instance of devenv.exe
(the one where your project is open) and press Attach
4. Check the "Common Language Runtime" checkbox
and press OK
5. Press Close

Using this new instance of Dev Studio you can now set
breakpoints in your code and examine its data etc.

I would start by having it break into the debugger when
an exception is thrown. You can set this up through
the "Exceptions..." on the Debug menu. Highlite "Common
Language Runtime Exceptions" in the list, select "Break
into the debugger" in the top group box ("When the exception...")
and then press OK. Now go back to the instance where your
project is and open the form in the designer. This should cause
the new instance to break into the debugger. It will probably
show an assembler window so you might need open the source
file manually though.

/claes
 
G

Guest

Claes

I appreciate your time and effort.

I performed the tasks you suggested. And sure enough it trapped an error
occurring when trying to display form in DesignMode. I recieved the
following error:

A first chance exception of type 'System.NullReferenceException' occured
in
microsoft.visualstudio.dll.

Additional Information: Object reference not set to an instance of an
object

Below is the disassembly of the offending code:

00000000 push eax
00000001 push edi
00000002 push esi
00000003 push ebx
00000004 push ebp
00000005 mov dword ptr [esp+10h],edx
00000009 mov edi,ecx
0000000b mov ecx,edi
0000000d call dword ptr ds:[7A59466Ch]
00000013 xor ebx,ebx
00000015 mov ebp,dword ptr [edi+0Ch]
00000018 xor esi,esi
0000001a cmp dword ptr [ebp+4],0
0000001e jle 00000044
00000020 cmp esi,dword ptr [ebp+4]
00000023 jae 0000004C
00000025 mov eax,dword ptr [ebp+esi*4+0Ch]
00000029 mov edx,dword ptr [eax+4]
0000002c push dword ptr [esp+10h]
00000030 mov ecx,edi
00000032 call dword ptr ds:[7A594348h]
00000038 cmp eax,ebx
0000003a jle 0000003E
0000003c mov ebx,eax
0000003e inc esi
0000003f cmp esi,dword ptr [ebp+4]
00000042 jl 00000020
00000044 mov eax,ebx
00000046 pop ebp
00000047 pop ebx
00000048 pop esi
00000049 pop edi
0000004a pop ecx
0000004b ret
0000004c xor ecx,ecx
0000004e call dword ptr ds:[7A5A79E4h]
00000054 int 3

The line where the error occured is

0000001a cmp dword ptr [ebp+4],0

Now only if I knew what the heck that means (lol).

Any ideas on what is causing the error? What is throwing the
'System.NullReferenceExceptio'? How to correct the problem?

Once again, I really to appreciate all your time and effort.

Tom

(e-mail address removed)
 
C

Claes Bergefall

Sorry, can't help you with the assembler code.
Just do what you normally do when debugging an
application. Check the callstack, check parameter values
set breakpoints etc

Does the callstack show any of your code?
If so, go there and set a breakpoint on that row
and start looking for anything that might be null
(if the source doesn't automatically comes up when
you double click on the row in the call stack list,
just open the file manually from the File menu)

If possible, post the project here and I can take
a look at it.

/claes

TMesh said:
Claes

I appreciate your time and effort.

I performed the tasks you suggested. And sure enough it trapped an error
occurring when trying to display form in DesignMode. I recieved the
following error:

A first chance exception of type 'System.NullReferenceException' occured
in
microsoft.visualstudio.dll.

Additional Information: Object reference not set to an instance of an
object

Below is the disassembly of the offending code:

00000000 push eax
00000001 push edi
00000002 push esi
00000003 push ebx
00000004 push ebp
00000005 mov dword ptr [esp+10h],edx
00000009 mov edi,ecx
0000000b mov ecx,edi
0000000d call dword ptr ds:[7A59466Ch]
00000013 xor ebx,ebx
00000015 mov ebp,dword ptr [edi+0Ch]
00000018 xor esi,esi
0000001a cmp dword ptr [ebp+4],0
0000001e jle 00000044
00000020 cmp esi,dword ptr [ebp+4]
00000023 jae 0000004C
00000025 mov eax,dword ptr [ebp+esi*4+0Ch]
00000029 mov edx,dword ptr [eax+4]
0000002c push dword ptr [esp+10h]
00000030 mov ecx,edi
00000032 call dword ptr ds:[7A594348h]
00000038 cmp eax,ebx
0000003a jle 0000003E
0000003c mov ebx,eax
0000003e inc esi
0000003f cmp esi,dword ptr [ebp+4]
00000042 jl 00000020
00000044 mov eax,ebx
00000046 pop ebp
00000047 pop ebx
00000048 pop esi
00000049 pop edi
0000004a pop ecx
0000004b ret
0000004c xor ecx,ecx
0000004e call dword ptr ds:[7A5A79E4h]
00000054 int 3

The line where the error occured is

0000001a cmp dword ptr [ebp+4],0

Now only if I knew what the heck that means (lol).

Any ideas on what is causing the error? What is throwing the
'System.NullReferenceExceptio'? How to correct the problem?

Once again, I really to appreciate all your time and effort.

Tom

(e-mail address removed)


Claes Bergefall said:
That sounds really strange. Try debugging the design time
environment:

1. Start a new instance of Dev Studio
2. Select "Debug Processes..." on the Tools menu
3. Select the previously running instance of devenv.exe
(the one where your project is open) and press Attach
4. Check the "Common Language Runtime" checkbox
and press OK
5. Press Close

Using this new instance of Dev Studio you can now set
breakpoints in your code and examine its data etc.

I would start by having it break into the debugger when
an exception is thrown. You can set this up through
the "Exceptions..." on the Debug menu. Highlite "Common
Language Runtime Exceptions" in the list, select "Break
into the debugger" in the top group box ("When the exception...")
and then press OK. Now go back to the instance where your
project is and open the form in the designer. This should cause
the new instance to break into the debugger. It will probably
show an assembler window so you might need open the source
file manually though.

/claes


EvaluationID
As my
MDI out
the is
back run
time.
 
C

Chris

What is m_C_EvaluationStatus? And where do you instantiate it? In the
code you showed, you declare the variable with this line:

Private WithEvents m_C_EvaluationStatus As EvaluationStatus

Do you ever call the New operator? Like this:
m_C_EvaluationStatus = New EvaluationStatus
 
G

Guest

Claes

I will post the project here. If you have a chance to look at it, I would
appreciate it. I tried setting a few break points, but they never got hit.
I wish I could post the call stack here, but no way to copy it.

I could send the project if you would just send me an e-mail to the address
below my name. Thanks for your time again.

Tom

(e-mail address removed)



Claes Bergefall said:
Sorry, can't help you with the assembler code.
Just do what you normally do when debugging an
application. Check the callstack, check parameter values
set breakpoints etc

Does the callstack show any of your code?
If so, go there and set a breakpoint on that row
and start looking for anything that might be null
(if the source doesn't automatically comes up when
you double click on the row in the call stack list,
just open the file manually from the File menu)

If possible, post the project here and I can take
a look at it.

/claes

TMesh said:
Claes

I appreciate your time and effort.

I performed the tasks you suggested. And sure enough it trapped an error
occurring when trying to display form in DesignMode. I recieved the
following error:

A first chance exception of type 'System.NullReferenceException' occured
in
microsoft.visualstudio.dll.

Additional Information: Object reference not set to an instance of an
object

Below is the disassembly of the offending code:

00000000 push eax
00000001 push edi
00000002 push esi
00000003 push ebx
00000004 push ebp
00000005 mov dword ptr [esp+10h],edx
00000009 mov edi,ecx
0000000b mov ecx,edi
0000000d call dword ptr ds:[7A59466Ch]
00000013 xor ebx,ebx
00000015 mov ebp,dword ptr [edi+0Ch]
00000018 xor esi,esi
0000001a cmp dword ptr [ebp+4],0
0000001e jle 00000044
00000020 cmp esi,dword ptr [ebp+4]
00000023 jae 0000004C
00000025 mov eax,dword ptr [ebp+esi*4+0Ch]
00000029 mov edx,dword ptr [eax+4]
0000002c push dword ptr [esp+10h]
00000030 mov ecx,edi
00000032 call dword ptr ds:[7A594348h]
00000038 cmp eax,ebx
0000003a jle 0000003E
0000003c mov ebx,eax
0000003e inc esi
0000003f cmp esi,dword ptr [ebp+4]
00000042 jl 00000020
00000044 mov eax,ebx
00000046 pop ebp
00000047 pop ebx
00000048 pop esi
00000049 pop edi
0000004a pop ecx
0000004b ret
0000004c xor ecx,ecx
0000004e call dword ptr ds:[7A5A79E4h]
00000054 int 3

The line where the error occured is

0000001a cmp dword ptr [ebp+4],0

Now only if I knew what the heck that means (lol).

Any ideas on what is causing the error? What is throwing the
'System.NullReferenceExceptio'? How to correct the problem?

Once again, I really to appreciate all your time and effort.

Tom

(e-mail address removed)


Claes Bergefall said:
That sounds really strange. Try debugging the design time
environment:

1. Start a new instance of Dev Studio
2. Select "Debug Processes..." on the Tools menu
3. Select the previously running instance of devenv.exe
(the one where your project is open) and press Attach
4. Check the "Common Language Runtime" checkbox
and press OK
5. Press Close

Using this new instance of Dev Studio you can now set
breakpoints in your code and examine its data etc.

I would start by having it break into the debugger when
an exception is thrown. You can set this up through
the "Exceptions..." on the Debug menu. Highlite "Common
Language Runtime Exceptions" in the list, select "Break
into the debugger" in the top group box ("When the exception...")
and then press OK. Now go back to the instance where your
project is and open the form in the designer. This should cause
the new instance to break into the debugger. It will probably
show an assembler window so you might need open the source
file manually though.

/claes


Claes

I did not post the code within the procedure cause I currently have it all
commented out. I get the error message just the following in my code:

Private Sub m_C_EvaluationStatus_EvaluationRequest(ByVal EvaluationID
As
Long) Handles m_C_EvaluationStatus.EvaluationRequest

End Sub

Which is the cause of my confusion. I select the object from the dropdown
on the left and then the event from the dropdown on the right. The above
code appears as it should, but then I can no longer view the design of my
MDI
form until I place a comment before "Handles".

It is really really strange.

Hope this sheds a little more light on the problem I am experiencing.

Tom

(e-mail address removed)

:

You're probably doing something in your event handler that
doesn't work in design mode. Since you didn't post the code
I can't help you very much. Try using the DesignMode
property to wrap the code

/claes


Hello

I am writing an application with VS 2003 VB.Net. I am getting the
error
message "Object reference not set to an instance of an object" in the
design
environment when trying to view a form in design mode.

I have traced when this happens but I can not figure out why it
happens.

I have an MDI form which declares a variable as follows:

Private WithEvents m_C_EvaluationStatus As EvaluationStatus

Where EvaluationStatus is a class. Within my MDI form i have a
procedure
to
capture an event fired within the class as follows:

Private Sub m_C_EvaluationStatus_EvaluationRequest(ByVal
EvaluationID As
Long) Handles m_C_EvaluationStatus.EvaluationRequest

.. Code to process event

End Sub

I get the error message when ever I have this procedure within the MDI
form
and can no longer view the MDI form in design mode. If I comment out
the
"Handles m_C_EvaluationStatus.EvaluationRequest", then everything is
back
to
normal in design environment, but no longer processing event at run
time.

Can anyone tell me why I am getting the error message "Object
reference
not
set to an instance of an object"?

Thanks in advance.
Tom

(e-mail address removed)
 
G

Guest

Chris

Here is the code which instantiates the class:

'Instantiate new EvaluationStatus class as "m_C_EvaluationStatus"
m_C_EvaluationStatus = New EvaluationStatus(m_C_Security,
dsEvaluationStatus)

'Create new instance of form class
m_F_EvaluatorStatus = New frmEvaluationStatus

'Add "Form closed" handler for frmReporting
AddHandler m_F_EvaluatorStatus.Closed, AddressOf
m_F_EvaluatorStatus_Closed

'Set main form as parent
m_F_EvaluatorStatus.MdiParent = Me

'Check to see if intialization of the evaluation status form was
successful
If Not
m_C_EvaluationStatus.InitializeEvaluationStatus(m_F_EvaluatorStatus) = True
Then
'If not, display error message to user and close form
UserAlert.ShowMessage("Evaluation Status form failed to intialize
(frmMain.Load).", _
UserAlert.ContactHelpDesk, _
"Program Startup Error", _
UserAlert.MessageStyle.Information, _
UserAlert.AlertStyle.IconError, _
False)

'Close elvaluation form
m_F_EvaluatorStatus.Close()
'Release memory resources
m_F_EvaluatorStatus.Dispose()
m_F_EvaluatorStatus = Nothing
End If

This is done when the application is loaded and after the user has been
validated via a login screen.

If you need to see anything else, let me know.

Thanks for your time.

Tom

(e-mail address removed)
 
C

Claes Bergefall

OK. Either post it in this news group or send it to me directly
at claes.bergefall(at)acandofrontec.se
(replace (at) with @)

/claes

TMesh said:
Claes

I will post the project here. If you have a chance to look at it, I would
appreciate it. I tried setting a few break points, but they never got hit.
I wish I could post the call stack here, but no way to copy it.

I could send the project if you would just send me an e-mail to the address
below my name. Thanks for your time again.

Tom

(e-mail address removed)



Claes Bergefall said:
Sorry, can't help you with the assembler code.
Just do what you normally do when debugging an
application. Check the callstack, check parameter values
set breakpoints etc

Does the callstack show any of your code?
If so, go there and set a breakpoint on that row
and start looking for anything that might be null
(if the source doesn't automatically comes up when
you double click on the row in the call stack list,
just open the file manually from the File menu)

If possible, post the project here and I can take
a look at it.

/claes

TMesh said:
Claes

I appreciate your time and effort.

I performed the tasks you suggested. And sure enough it trapped an error
occurring when trying to display form in DesignMode. I recieved the
following error:

A first chance exception of type 'System.NullReferenceException' occured
in
microsoft.visualstudio.dll.

Additional Information: Object reference not set to an instance of an
object

Below is the disassembly of the offending code:

00000000 push eax
00000001 push edi
00000002 push esi
00000003 push ebx
00000004 push ebp
00000005 mov dword ptr [esp+10h],edx
00000009 mov edi,ecx
0000000b mov ecx,edi
0000000d call dword ptr ds:[7A59466Ch]
00000013 xor ebx,ebx
00000015 mov ebp,dword ptr [edi+0Ch]
00000018 xor esi,esi
0000001a cmp dword ptr [ebp+4],0
0000001e jle 00000044
00000020 cmp esi,dword ptr [ebp+4]
00000023 jae 0000004C
00000025 mov eax,dword ptr [ebp+esi*4+0Ch]
00000029 mov edx,dword ptr [eax+4]
0000002c push dword ptr [esp+10h]
00000030 mov ecx,edi
00000032 call dword ptr ds:[7A594348h]
00000038 cmp eax,ebx
0000003a jle 0000003E
0000003c mov ebx,eax
0000003e inc esi
0000003f cmp esi,dword ptr [ebp+4]
00000042 jl 00000020
00000044 mov eax,ebx
00000046 pop ebp
00000047 pop ebx
00000048 pop esi
00000049 pop edi
0000004a pop ecx
0000004b ret
0000004c xor ecx,ecx
0000004e call dword ptr ds:[7A5A79E4h]
00000054 int 3

The line where the error occured is

0000001a cmp dword ptr [ebp+4],0

Now only if I knew what the heck that means (lol).

Any ideas on what is causing the error? What is throwing the
'System.NullReferenceExceptio'? How to correct the problem?

Once again, I really to appreciate all your time and effort.

Tom

(e-mail address removed)


:

That sounds really strange. Try debugging the design time
environment:

1. Start a new instance of Dev Studio
2. Select "Debug Processes..." on the Tools menu
3. Select the previously running instance of devenv.exe
(the one where your project is open) and press Attach
4. Check the "Common Language Runtime" checkbox
and press OK
5. Press Close

Using this new instance of Dev Studio you can now set
breakpoints in your code and examine its data etc.

I would start by having it break into the debugger when
an exception is thrown. You can set this up through
the "Exceptions..." on the Debug menu. Highlite "Common
Language Runtime Exceptions" in the list, select "Break
into the debugger" in the top group box ("When the exception...")
and then press OK. Now go back to the instance where your
project is and open the form in the designer. This should cause
the new instance to break into the debugger. It will probably
show an assembler window so you might need open the source
file manually though.

/claes


Claes

I did not post the code within the procedure cause I currently
have it
all
commented out. I get the error message just the following in my code:

Private Sub m_C_EvaluationStatus_EvaluationRequest(ByVal EvaluationID
As
Long) Handles m_C_EvaluationStatus.EvaluationRequest

End Sub

Which is the cause of my confusion. I select the object from the dropdown
on the left and then the event from the dropdown on the right.
The
above
code appears as it should, but then I can no longer view the
design of
my
MDI
form until I place a comment before "Handles".

It is really really strange.

Hope this sheds a little more light on the problem I am experiencing.

Tom

(e-mail address removed)

:

You're probably doing something in your event handler that
doesn't work in design mode. Since you didn't post the code
I can't help you very much. Try using the DesignMode
property to wrap the code

/claes


Hello

I am writing an application with VS 2003 VB.Net. I am getting the
error
message "Object reference not set to an instance of an object"
in
the
design
environment when trying to view a form in design mode.

I have traced when this happens but I can not figure out why it
happens.

I have an MDI form which declares a variable as follows:

Private WithEvents m_C_EvaluationStatus As EvaluationStatus

Where EvaluationStatus is a class. Within my MDI form i have a
procedure
to
capture an event fired within the class as follows:

Private Sub m_C_EvaluationStatus_EvaluationRequest(ByVal
EvaluationID As
Long) Handles m_C_EvaluationStatus.EvaluationRequest

.. Code to process event

End Sub

I get the error message when ever I have this procedure within
the
MDI
form
and can no longer view the MDI form in design mode. If I
comment
out
the
"Handles m_C_EvaluationStatus.EvaluationRequest", then
everything
is
back
to
normal in design environment, but no longer processing event
at
run
time.

Can anyone tell me why I am getting the error message "Object
reference
not
set to an instance of an object"?

Thanks in advance.
Tom

(e-mail address removed)
 
G

Guest

Claes

I sent you the project. Just checking back to see if you received it OK and
if you had a chance to look it over. Wondering if it is doing the same thing
for you when you try and view the design mode of the MDI form.

Thanks in advance.

Tom

(e-mail address removed)



Claes Bergefall said:
OK. Either post it in this news group or send it to me directly
at claes.bergefall(at)acandofrontec.se
(replace (at) with @)

/claes

TMesh said:
Claes

I will post the project here. If you have a chance to look at it, I would
appreciate it. I tried setting a few break points, but they never got hit.
I wish I could post the call stack here, but no way to copy it.

I could send the project if you would just send me an e-mail to the address
below my name. Thanks for your time again.

Tom

(e-mail address removed)



Claes Bergefall said:
Sorry, can't help you with the assembler code.
Just do what you normally do when debugging an
application. Check the callstack, check parameter values
set breakpoints etc

Does the callstack show any of your code?
If so, go there and set a breakpoint on that row
and start looking for anything that might be null
(if the source doesn't automatically comes up when
you double click on the row in the call stack list,
just open the file manually from the File menu)

If possible, post the project here and I can take
a look at it.

/claes

Claes

I appreciate your time and effort.

I performed the tasks you suggested. And sure enough it trapped an error
occurring when trying to display form in DesignMode. I recieved the
following error:

A first chance exception of type 'System.NullReferenceException'
occured
in
microsoft.visualstudio.dll.

Additional Information: Object reference not set to an instance of an
object

Below is the disassembly of the offending code:

00000000 push eax
00000001 push edi
00000002 push esi
00000003 push ebx
00000004 push ebp
00000005 mov dword ptr [esp+10h],edx
00000009 mov edi,ecx
0000000b mov ecx,edi
0000000d call dword ptr ds:[7A59466Ch]
00000013 xor ebx,ebx
00000015 mov ebp,dword ptr [edi+0Ch]
00000018 xor esi,esi
0000001a cmp dword ptr [ebp+4],0
0000001e jle 00000044
00000020 cmp esi,dword ptr [ebp+4]
00000023 jae 0000004C
00000025 mov eax,dword ptr [ebp+esi*4+0Ch]
00000029 mov edx,dword ptr [eax+4]
0000002c push dword ptr [esp+10h]
00000030 mov ecx,edi
00000032 call dword ptr ds:[7A594348h]
00000038 cmp eax,ebx
0000003a jle 0000003E
0000003c mov ebx,eax
0000003e inc esi
0000003f cmp esi,dword ptr [ebp+4]
00000042 jl 00000020
00000044 mov eax,ebx
00000046 pop ebp
00000047 pop ebx
00000048 pop esi
00000049 pop edi
0000004a pop ecx
0000004b ret
0000004c xor ecx,ecx
0000004e call dword ptr ds:[7A5A79E4h]
00000054 int 3

The line where the error occured is

0000001a cmp dword ptr [ebp+4],0

Now only if I knew what the heck that means (lol).

Any ideas on what is causing the error? What is throwing the
'System.NullReferenceExceptio'? How to correct the problem?

Once again, I really to appreciate all your time and effort.

Tom

(e-mail address removed)


:

That sounds really strange. Try debugging the design time
environment:

1. Start a new instance of Dev Studio
2. Select "Debug Processes..." on the Tools menu
3. Select the previously running instance of devenv.exe
(the one where your project is open) and press Attach
4. Check the "Common Language Runtime" checkbox
and press OK
5. Press Close

Using this new instance of Dev Studio you can now set
breakpoints in your code and examine its data etc.

I would start by having it break into the debugger when
an exception is thrown. You can set this up through
the "Exceptions..." on the Debug menu. Highlite "Common
Language Runtime Exceptions" in the list, select "Break
into the debugger" in the top group box ("When the exception...")
and then press OK. Now go back to the instance where your
project is and open the form in the designer. This should cause
the new instance to break into the debugger. It will probably
show an assembler window so you might need open the source
file manually though.

/claes


Claes

I did not post the code within the procedure cause I currently have it
all
commented out. I get the error message just the following in my code:

Private Sub m_C_EvaluationStatus_EvaluationRequest(ByVal
EvaluationID
As
Long) Handles m_C_EvaluationStatus.EvaluationRequest

End Sub

Which is the cause of my confusion. I select the object from the
dropdown
on the left and then the event from the dropdown on the right. The
above
code appears as it should, but then I can no longer view the design of
my
MDI
form until I place a comment before "Handles".

It is really really strange.

Hope this sheds a little more light on the problem I am experiencing.

Tom

(e-mail address removed)

:

You're probably doing something in your event handler that
doesn't work in design mode. Since you didn't post the code
I can't help you very much. Try using the DesignMode
property to wrap the code

/claes


Hello

I am writing an application with VS 2003 VB.Net. I am getting the
error
message "Object reference not set to an instance of an object" in
the
design
environment when trying to view a form in design mode.

I have traced when this happens but I can not figure out why it
happens.

I have an MDI form which declares a variable as follows:

Private WithEvents m_C_EvaluationStatus As EvaluationStatus

Where EvaluationStatus is a class. Within my MDI form i have a
procedure
to
capture an event fired within the class as follows:

Private Sub m_C_EvaluationStatus_EvaluationRequest(ByVal
EvaluationID As
Long) Handles m_C_EvaluationStatus.EvaluationRequest

.. Code to process event

End Sub

I get the error message when ever I have this procedure within the
MDI
form
and can no longer view the MDI form in design mode. If I comment
out
the
"Handles m_C_EvaluationStatus.EvaluationRequest", then everything
is
back
to
normal in design environment, but no longer processing event at
run
time.

Can anyone tell me why I am getting the error message "Object
reference
not
set to an instance of an object"?

Thanks in advance.
Tom

(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top