• Rondotnet
  • 50.6% (Neutral)
  • YAF Forumling Topic Starter
11 years ago
Hey, I am a novice in dot net programming. I run a program in window 7 which runs perfectly in xp. It returns the following error which performing certain operations. Any idea what the problem is?

System.NullReferenceException: Object reference not set to an instance of an object.

at SMS.FrmMain.TreeView2_MouseUp(Object sender, MouseEventArgs e)

at System.Windows.Forms.Control.OnMouseUp(MouseEventArgs e)

at System.Windows.Forms.TreeView.WndProc(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


  • jpweber
  • 94.4% (Exalted)
  • YAF Commander
9 years ago
The error indicates an object is null.

For reference, if needed, MSDN Object Null Information 

Regardless, it appears your db.config not setup right. Please make sure the information in that file is correct.

So open up your YAF ---> db.config with notepad or whatever, and this:

providerName="System.Data.SqlClient" />

Make sure all that information is correct and is the proper information for your database. If you're using a shared host, go into your host's control panel and get the database information from there.

Upload the db.config and replace the old one and refresh your browser or clear the cache, and things should work properly.

Jason Weber

USS Vision YAF 

"Money is better than poverty, if only for financial reasons"

3 years ago
To fully understand why a NullReferenceException is thrown, it is important to know the difference between value types and reference types.

So, if you're dealing with value types, NullReferenceException s can not occur. Though you need to keep alert when dealing with reference types!

Only reference types, as the name is suggesting, can hold references or point literally to nothing (or 'null'). Whereas value types always contain a value.

Reference types (these ones must be checked):

  • dynamic



Value types (you can simply ignore these ones):

  • Numeric types

    Integral types

    Floating-point types



    User defined structs