Solved

System.InvalidOperationException was unhandled

Posted on 2007-04-05
2
704 Views
Last Modified: 2008-02-01
Hi Experts,

I have a piece of code that load up a form: -

frmCreatePurchaseOrder.show()

when I run it I get the following error message: -

System.InvalidOperationException was unhandled
  Message="An error occurred creating the form. See Exception.InnerException for details.  The error is: Object reference not set to an instance of an object."

What does this mean please and how can I find out whats causing it.

Many Thanks
Lee
0
Comment
Question by:ljhodgett
2 Comments
 
LVL 35

Accepted Solution

by:
YZlat earned 500 total points
ID: 18857757
use try...catch blocks:


try

  your code here

catch ex as exception
  MsgBox(ex.Message & " - " & ex.StackTrace)
end try
0
 
LVL 24

Expert Comment

by:Jeff Certain
ID: 18857788
Ummm... more to the point... frmCreatePurchaseOrder is probably set to nothing.

Try:
Dim frm as new frmCreatePurchaseOrder
frm.Show()
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now