Object reference not set to an instance of an object. for Listbox1.SelectedItem.Text

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Krupau
    New Member
    • Jan 2007
    • 1

    Object reference not set to an instance of an object. for Listbox1.SelectedItem.Text

    Hi Friends,


    I am getting following error message.. I am so fed up of this error. I am trying to solve it so long time. Please help me!! .Thanks in advance...


    Object reference not set to an instance of an object.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullRefe renceException: Object reference not set to an instance of an object.

    Source Error:


    Line 510: TextBox1.Text = "You Selected" + Listbox1.Select edItem.Text
  • bplacker
    New Member
    • Sep 2006
    • 121

    #2
    I have gotten this error when there is no item selected from the list. I solved it by saying ListBox1.Text instead of ListBox1.Select edItem.Text

    Comment

    • kenobewan
      Recognized Expert Specialist
      • Dec 2006
      • 4871

      #3
      If this doesn't work, try setting the datavaluefield and datatextfield to the appropriate field names...

      Hope that this helps.

      Comment

      Working...