#1
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)
Topic Starter
  • Rondotnet
  • Rank: YAF Forumling
  • Reputation:
    Neutral
    50.6%
  • Joined: 17/05/2011
  • Posts: 1
#2
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:

<add name="yafnet" connectionString="😉ata Source=sql2k805.XXXXXXXXXXXXXXXXXXXXXX;User ID=SQL2008R2_XXXXXXXXX_USER;Password=YOURPASSWORD"
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"
  • jpweber
  • Rank: YAF Commander
  • Reputation:
    Exalted
    94.4%
  • Joined: 21/03/2012
  • Posts: 126
  • Thanks: 38 times
  • Was thanked: 11 time(s) in 9 post(s)
#3
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
    object
    string


Value types (you can simply ignore these ones):

  • Numeric types
    Integral types
    Floating-point types
    decimal
    bool
    User defined structs
  • evanchatter
  • Rank: YAF Forumling
  • Reputation:
    Neutral
    50.6%
  • Joined: 30/10/2018
  • Posts: 1
  •  United Arab Emirates
  • Location: dubai
Forum Jump  
  • You cannot post new topics in this forum.
  • You cannot reply to topics in this forum.
  • You cannot delete your posts in this forum.
  • You cannot edit your posts in this forum.
  • You cannot create polls in this forum.
  • You cannot vote in polls in this forum.

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved