Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Thu, 3 Jul 2008 12:14:36 -0700 (PDT),    group: microsoft.public.dotnet.framework.windowsforms.controls        back       


event getting raised twice   
Hi,

i am having a problem with combobox selectedindexchanged event.

i have combobox as a member of a class i have created. it has an event
handler for selectedindexchanged event for that combo box.

now i have created two objects of that class and have a single dataset
as datasource for both combo boxes. now when i change selection in one
of them the event is raised twice for both combo boxes...


what to do??

thanks in advance
date: Thu, 3 Jul 2008 12:14:36 -0700 (PDT)   author:   aj

Re: event getting raised twice   
On Thu, 3 Jul 2008 12:14:36 -0700 (PDT), aj  wrote:

>Hi,
>
>i am having a problem with combobox selectedindexchanged event.
>
>i have combobox as a member of a class i have created. it has an event
>handler for selectedindexchanged event for that combo box.
>
>now i have created two objects of that class and have a single dataset
>as datasource for both combo boxes. now when i change selection in one
>of them the event is raised twice for both combo boxes...
>
>
>what to do??
>
>thanks in advance

When you change one combobox, the other will change to match it.  If
you don't want that create a BindingSource and put it between the
dataset and one of the comboboxes (you can create a BindingSource for
both but it is not necessary).

By default there is one CurrencyManager for all objects bound to the
same source, and therefore one current position.  When any object
bound to the source changes the position in the source, all bound
objects change their position.  By putting a BindingSource between the
source and one of the objects you are creating a separate
CurrencyManager for that object.

I'm not sure there is anything you can do about spurious
SelectedIndexChanged events, combobox seems to sometimes fire that
event multiple times.
date: Thu, 03 Jul 2008 14:52:17 -0700   author:   Jack Jackson

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us