473,326 Members | 2,815 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.

Databinding a ListBox fires multiple SelectedIndexChanged events

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 the form.

(It's a Company -> People -> Personal Data relationship)

When I bind my datasource to the ListBox, I find that the
SelectedIndexChanged event fires three times.
(I am using BeginUpdate / EndUpdate around the databinding statements.)

This multiple event firing causes the side effect of a form-flicker as the
last set of controls get cleared and set.

Is this normal behaviour for the ListBox when using databinding?

I do want the event to fire, but only after the databinding has completed
and only the one time.

Any help is appreciated.

Alec
Dec 2 '05 #1
3 7739
Alec,

There can be much reasons and always hard to show in a newsgroup (mostly you
need for that to much code), however prevent your listbox from selecting
when you find any data to it.

The beginupdate and endupdate does nothign in that, so you can do that by
setting a boolean when you do that and test that in the events from the
listbox, or just do removehandler and addhandler from those events what is
the nicest.

I hope this helps,

Cor

"Alec MacLean" <al**********@NO-SPAM-copeohs.com> schreef in bericht
news:O0**************@TK2MSFTNGP14.phx.gbl...
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 the form.

(It's a Company -> People -> Personal Data relationship)

When I bind my datasource to the ListBox, I find that the
SelectedIndexChanged event fires three times.
(I am using BeginUpdate / EndUpdate around the databinding statements.)

This multiple event firing causes the side effect of a form-flicker as the
last set of controls get cleared and set.

Is this normal behaviour for the ListBox when using databinding?

I do want the event to fire, but only after the databinding has completed
and only the one time.

Any help is appreciated.

Alec

Dec 3 '05 #2
Thanks Cor,

I've tried various approaches to resolving this - including your boolean
suggestion, but as yet nothing works quite how I'd like them to.

It's not an essential aspect, just a small tidying of the visual
presentation when the program loads.

Alec
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:u9**************@TK2MSFTNGP12.phx.gbl...
Alec,

There can be much reasons and always hard to show in a newsgroup (mostly
you need for that to much code), however prevent your listbox from
selecting when you find any data to it.

The beginupdate and endupdate does nothign in that, so you can do that by
setting a boolean when you do that and test that in the events from the
listbox, or just do removehandler and addhandler from those events what is
the nicest.

I hope this helps,

Cor

"Alec MacLean" <al**********@NO-SPAM-copeohs.com> schreef in bericht
news:O0**************@TK2MSFTNGP14.phx.gbl...
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 the form.

(It's a Company -> People -> Personal Data relationship)

When I bind my datasource to the ListBox, I find that the
SelectedIndexChanged event fires three times.
(I am using BeginUpdate / EndUpdate around the databinding statements.)

This multiple event firing causes the side effect of a form-flicker as
the last set of controls get cleared and set.

Is this normal behaviour for the ListBox when using databinding?

I do want the event to fire, but only after the databinding has completed
and only the one time.

Any help is appreciated.

Alec


Dec 12 '05 #3
Alec,

If you set it in the load_event, than your form is not yet showed. That is
where I set it normally therefore I probably did not understand you.

Cor

"Alec MacLean" <al**********@NO-SPAM-copeohs.com> schreef in bericht
Thanks Cor,

I've tried various approaches to resolving this - including your boolean
suggestion, but as yet nothing works quite how I'd like them to.

It's not an essential aspect, just a small tidying of the visual
presentation when the program loads.

Alec
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:u9**************@TK2MSFTNGP12.phx.gbl...
Alec,

There can be much reasons and always hard to show in a newsgroup (mostly
you need for that to much code), however prevent your listbox from
selecting when you find any data to it.

The beginupdate and endupdate does nothign in that, so you can do that by
setting a boolean when you do that and test that in the events from the
listbox, or just do removehandler and addhandler from those events what
is the nicest.

I hope this helps,

Cor

"Alec MacLean" <al**********@NO-SPAM-copeohs.com> schreef in bericht
news:O0**************@TK2MSFTNGP14.phx.gbl...
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 the form.

(It's a Company -> People -> Personal Data relationship)

When I bind my datasource to the ListBox, I find that the
SelectedIndexChanged event fires three times.
(I am using BeginUpdate / EndUpdate around the databinding statements.)

This multiple event firing causes the side effect of a form-flicker as
the last set of controls get cleared and set.

Is this normal behaviour for the ListBox when using databinding?

I do want the event to fire, but only after the databinding has
completed and only the one time.

Any help is appreciated.

Alec



Dec 12 '05 #4

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

Similar topics

4
by: KK | last post by:
Hi All... For my purpose, I need to handle listbox selection changed event.I must be notified before changing occurs and after.After I can handle using SelectedIndexChanged event.Is there anyway...
0
by: PeacError | last post by:
Using Microsoft Visual Studio .NET 2003, Visual C# .NET 1.1: I apologize if this question has been addressed elsewhere, but I could not find a reference to it in the search engine for this...
6
by: Glen Wolinsky | last post by:
I have two virtually identical listbox controls on a tabPage in my application. I bind a small datatable to each one when a new project (my data) is selected from a treeview control (this works...
2
by: Sidney | last post by:
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...
2
by: Dave A | last post by:
I am stuggling with databinding a drop down list, hooking into the SelectedIndexChanged and attempting to avoid using the viewstate. The drop down list is quite large so I would prefer to avoid...
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...
9
by: zdrakec | last post by:
Hello all: Clearly, I'm not getting it! Here is the scenario: On a web page, I have two list boxen and a text box. The first listbox is populated at page load time (if it is not a postback)....
2
by: =?Utf-8?B?U2F2dm91bGlkaXMgSW9yZGFuaXM=?= | last post by:
Which is the event sequence when a gridview button (for update) is clicked and the page is post back? I am also a bit confused when to use ..IsPostBack(). If my page data is changing maybe in every...
6
by: Mike | last post by:
Is there a way to get a ListView control to fire its SelectedIndexChanged event like the ListBox control? When the user selects multiple items at once, the ListView fires the event as each item...
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...
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: 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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
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: 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
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.