About Databinding of Listbox

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

    #1

    About Databinding of Listbox

    I tried to databind the listbox in vb.net with dataset
    I wrote some code in the listbox selectedindexch anged event, however,
    whenever the programme goes to the selectedindexch anged, it hanged and I
    need to closed the whole system
    it appear this problem also when i click a check box which the the
    CheckedChanged event in the check box
    need refreshing the dataset with another SQL code

    Thanks a lot~

    Sidney


  • Cor Ligthert [MVP]

    #2
    Re: About Databinding of Listbox

    Sidney,

    This is not so much asked as in past. The selected index fires as soon as
    you set the datasource to the listbox.

    There are two solution:
    Set a switch in your selectex index change event that you set to true as
    every thing is initial set in your listbox

    Add the handler as soon as everything set in the listbox.

    The last (in my opinion the nicest) you can see how in the bottom of the
    form load in this sample.



    Don't than forget the addhandler at the end of the event sub.

    I hope this helps.

    Cor

    "Sidney" <Sidney_sy@hotm ail.com> schreef in bericht
    news:uIK8kqI2FH A.1032@TK2MSFTN GP12.phx.gbl...[color=blue]
    >I tried to databind the listbox in vb.net with dataset
    > I wrote some code in the listbox selectedindexch anged event, however,
    > whenever the programme goes to the selectedindexch anged, it hanged and I
    > need to closed the whole system
    > it appear this problem also when i click a check box which the the
    > CheckedChanged event in the check box
    > need refreshing the dataset with another SQL code
    >
    > Thanks a lot~
    >
    > Sidney
    >[/color]


    Comment

    • Sidney

      #3
      Re: About Databinding of Listbox

      Cor,

      Thanks for your answer, I'll try it!
      Thanks so much!

      Sidney


      "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> ¼¶¼g©ó¶l¥ó·s»D: eDsiU4J2FHA.254 0@TK2MSFTNGP09. phx.gbl...[color=blue]
      > Sidney,
      >
      > This is not so much asked as in past. The selected index fires as soon as
      > you set the datasource to the listbox.
      >
      > There are two solution:
      > Set a switch in your selectex index change event that you set to true as
      > every thing is initial set in your listbox
      >
      > Add the handler as soon as everything set in the listbox.
      >
      > The last (in my opinion the nicest) you can see how in the bottom of the
      > form load in this sample.
      >
      > http://www.vb-tips.com/default.aspx?...8-a5006c96efe4
      >
      > Don't than forget the addhandler at the end of the event sub.
      >
      > I hope this helps.
      >
      > Cor
      >
      > "Sidney" <Sidney_sy@hotm ail.com> schreef in bericht
      > news:uIK8kqI2FH A.1032@TK2MSFTN GP12.phx.gbl...[color=green]
      >>I tried to databind the listbox in vb.net with dataset
      >> I wrote some code in the listbox selectedindexch anged event, however,
      >> whenever the programme goes to the selectedindexch anged, it hanged and I
      >> need to closed the whole system
      >> it appear this problem also when i click a check box which the the
      >> CheckedChanged event in the check box
      >> need refreshing the dataset with another SQL code
      >>
      >> Thanks a lot~
      >>
      >> Sidney
      >>[/color]
      >
      >[/color]


      Comment

      Working...