Object reference not set!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gilgamesh

    #1

    Object reference not set!

    Hi,
    Assigning the DataSource of a Combobox to a dataview, on a win form, throws
    the exception "Object reference not set to an instance of an object". The
    ComboBox has already been created and is a valid object. The Dataview is
    also valid and has data in it. Any idea why this exception is thrown?

    Thanks,
    Gilgamesh


  • Chris Capel

    #2
    Re: Object reference not set!

    Could you reply with a short but complete example in which the problem is
    reproduced? Instead of binding to a Dataview filled from a database, you
    could try filling the Dataview manually somehow. If you can only reproduce
    the problem with a database, I don't know that we could help you.

    Chris

    "Gilgamesh" <gilgamesh@xter anet.com> wrote in message
    news:euS9uPVeDH A.2432@TK2MSFTN GP09.phx.gbl...[color=blue]
    > Hi,
    > Assigning the DataSource of a Combobox to a dataview, on a win form,[/color]
    throws[color=blue]
    > the exception "Object reference not set to an instance of an object". The
    > ComboBox has already been created and is a valid object. The Dataview is
    > also valid and has data in it. Any idea why this exception is thrown?
    >
    > Thanks,
    > Gilgamesh
    >
    >[/color]


    Comment

    • Gilgamesh

      #3
      Re: Object reference not set!

      Here is the code:

      Branch br = new Branch();
      dv = br.GetBranchesA ll().DefaultVie w;
      cmbBranchNum.Di splayMember = "BRANCH_NO" ; //No Exception is thrown
      here
      cmbBranchNum.Va lueMember = "BRANCH_NO" ; //No Exception is thrown here
      cmbBranchNum.Da taSource = dv; //Here is where
      the exception is thrown

      BTW, I've got a couple of other combo boxes on this form, and they all work
      just fine.

      Thanks,
      G.

      "Chris Capel" <chris@ibanktec h.net> wrote in message
      news:eKv9FAWeDH A.620@TK2MSFTNG P11.phx.gbl...[color=blue]
      > Could you reply with a short but complete example in which the problem is
      > reproduced? Instead of binding to a Dataview filled from a database, you
      > could try filling the Dataview manually somehow. If you can only reproduce
      > the problem with a database, I don't know that we could help you.
      >
      > Chris
      >
      > "Gilgamesh" <gilgamesh@xter anet.com> wrote in message
      > news:euS9uPVeDH A.2432@TK2MSFTN GP09.phx.gbl...[color=green]
      > > Hi,
      > > Assigning the DataSource of a Combobox to a dataview, on a win form,[/color]
      > throws[color=green]
      > > the exception "Object reference not set to an instance of an object".[/color][/color]
      The[color=blue][color=green]
      > > ComboBox has already been created and is a valid object. The Dataview is
      > > also valid and has data in it. Any idea why this exception is thrown?
      > >
      > > Thanks,
      > > Gilgamesh
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...