473,326 Members | 2,090 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,326 software developers and data experts.

listbox events

Hey all,

I noticed that the listbox event "SelectedIndex_Changed" runs on form load
by default. Is there a way to by pass this until you actually have data in it
and are ready for selected index change event in your code or am I missing
the point?

thanks in advance,
rodchar
Nov 21 '05 #1
4 3224
Are you sure? Just to make sure, I tested it out and it does not fire the
SelectedIndex_Changed event on the listbox. Are you setting the
SelectedIndex or SelectedItem property (or calling the Select method) in the
form load? Only then the event would be fired.
Imran.

"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:4C**********************************@microsof t.com...
Hey all,

I noticed that the listbox event "SelectedIndex_Changed" runs on form load
by default. Is there a way to by pass this until you actually have data in
it
and are ready for selected index change event in your code or am I missing
the point?

thanks in advance,
rodchar

Nov 21 '05 #2
if your listbox is databound, the index will change on filling a dataset...
the best thing to do in that case is to set a flag when its filling so you
can check that flag in the selected index changed event to see if the index
is changing while its filling or not to prevent execution of the event while
that is happening

"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:4C**********************************@microsof t.com...
Hey all,

I noticed that the listbox event "SelectedIndex_Changed" runs on form load
by default. Is there a way to by pass this until you actually have data in
it
and are ready for selected index change event in your code or am I missing
the point?

thanks in advance,
rodchar

Nov 21 '05 #3
Thank you, this helped.

"Brian Henry" wrote:
if your listbox is databound, the index will change on filling a dataset...
the best thing to do in that case is to set a flag when its filling so you
can check that flag in the selected index changed event to see if the index
is changing while its filling or not to prevent execution of the event while
that is happening

"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:4C**********************************@microsof t.com...
Hey all,

I noticed that the listbox event "SelectedIndex_Changed" runs on form load
by default. Is there a way to by pass this until you actually have data in
it
and are ready for selected index change event in your code or am I missing
the point?

thanks in advance,
rodchar


Nov 21 '05 #4
Thank you, this helped.

"Brian Henry" wrote:
if your listbox is databound, the index will change on filling a dataset...
the best thing to do in that case is to set a flag when its filling so you
can check that flag in the selected index changed event to see if the index
is changing while its filling or not to prevent execution of the event while
that is happening

"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:4C**********************************@microsof t.com...
Hey all,

I noticed that the listbox event "SelectedIndex_Changed" runs on form load
by default. Is there a way to by pass this until you actually have data in
it
and are ready for selected index change event in your code or am I missing
the point?

thanks in advance,
rodchar


Nov 21 '05 #5

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

Similar topics

3
by: amber | last post by:
Hello, I'm having trouble findingwhich event I need to use with a listbox. When a user selects a new item in the listbox, I want to trigger an event BEFORE the new item is actually selected. ...
8
by: Oddball | last post by:
Ok - I have a ListBox control and I'm ready to write my own DrawItem event handler. What I want to draw as the item is another control. I have created a user control that I would like to list in...
18
by: Dave Sauny | last post by:
Ok, its a friday, I'm at work and I cant get this to work: I have 3 listboxes on one tab control page. when i select an item in listbox1 i want whatever is selected on the other 2 listboxes...
2
by: Rlrcstr | last post by:
I'm rolling my own with a listbox. The items in the list box are of varying sizes and I'm hit checking when the litbox is checked to see what portion of an item the user has clicked on. Mostly...
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: tony | last post by:
Hello! If you drag a ListBox into a windowform and then right click on this ListBox and then chose property. When you have the properties up click on the flash symbol for seeing all the events...
2
by: Steve Potter | last post by:
I am trying to find some method of attaching a Listbox object to a list object so as the contents of the list are changed the contents of the Listbox will be updated to match. I have found a few...
18
by: Zytan | last post by:
I want the same function to be run whether you press Enter or double click the listbox. It seems really verbose to write both handlers to both events everytime, even if they both call the same...
2
by: =?Utf-8?B?Sm9hY2hpbQ==?= | last post by:
I have tried to use a ListBox with SelectionMode set to MultiSimple. I have also tried quite a lot of the event handlers, but no events seem to be triggered. Why aren't the events triggered?
6
by: Dom | last post by:
In some programs, I see that certain items in a listbox have been grayed, to indicate that they are "there" but can not be chosen. This is very helpful. Can you do this in CSharp? Is there a...
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
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: 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)...
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.