473,320 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

About Databinding of Listbox

I tried to databind the listbox in vb.net with dataset
I wrote some code in the listbox selectedindexchanged event, however,
whenever the programme goes to the selectedindexchanged, 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
Nov 21 '05 #1
2 2919
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" <Si*******@hotmail.com> schreef in bericht
news:uI**************@TK2MSFTNGP12.phx.gbl...
I tried to databind the listbox in vb.net with dataset
I wrote some code in the listbox selectedindexchanged event, however,
whenever the programme goes to the selectedindexchanged, 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

Nov 21 '05 #2
Cor,

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

Sidney
"Cor Ligthert [MVP]" <no************@planet.nl> ¼¶¼g©ó¶l¥ó·s»D:eD**************@TK2MSFTNGP09.phx.g bl...
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" <Si*******@hotmail.com> schreef in bericht
news:uI**************@TK2MSFTNGP12.phx.gbl...
I tried to databind the listbox in vb.net with dataset
I wrote some code in the listbox selectedindexchanged event, however,
whenever the programme goes to the selectedindexchanged, 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


Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: dtblankenship | last post by:
Hello everyone, I know this question has been asked many times in the forums, and after spending a few days reading, I am still confused as to the answer. I have a ListBox (lstBox),...
1
by: Stephen | last post by:
I have a form with a ListBox and would like to set the DataSource property at design-time but I can't seem to declare any kind of variable that will show up in the list. I have tried a traditional...
1
by: amar shukla | last post by:
hi all, i have a problem, i am coding a problem, which is suppose to fetch records from database into a combobox and there after based on the selection of value it has to proceed further , i...
3
by: Alec MacLean | last post by:
Hi everyone, I have a ComboBox that when changed, calls a method to change the content of a ListBox. I'm also using the Listbox's SelectedIndexChanged event to change other control values on...
1
by: Hoffmania | last post by:
Is there a good tutorial of getting databinding working with NHibernate collections such as bags with lazy loading. I can access the collection programaticly, but not directly with databinding.
2
by: musosdev | last post by:
Hi guys I have an asp:ListBox on my form, which I'm populating with a DataReader, using DataSource/DataBind. The problem is that the main field I want to use for DataTextField, "Company" in...
6
by: Paul | last post by:
Hi All, Framework 1.1 listbox control unable to DataBind I've been googling for an answer to this query that appears quite a lot, but none, it seem, answers my problem directly. I am...
0
by: bnolingberg | last post by:
Hi all. I've been stuck on this problem for a while (I'm a newbie). I have a listbox with several collection objects, some of them being identical. When one of the collection items is selected...
3
by: Peter | last post by:
Hi! I am having some very strange behavior with my databound controls. It's taken a long time to isolate exactly what is provoking the problem, but I'm still leagues away from solving it. I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.