Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
InteractiveChange fires in comboBox during form load
Message
From
03/04/2006 18:18:09
 
 
To
03/04/2006 08:53:53
General information
Forum:
ASP.NET
Category:
Other
Environment versions
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Jet/Access Engine
Miscellaneous
Thread ID:
01109763
Message ID:
01110108
Views:
19
Vince,

Yeah, try/catch is not an optimal solution in this case ... catching exceptions is very expensive time-wise, and the fact that these events will fire several times for each Combo when the Form loads makes it even worse! Are you sure it's a ComboBox InteractiveChange event you're hooking into? I don't see that anywhere. I typically use the .SelectedIndexChanged event.

I'm not 100% sure of the VB code to use, but let me take a stab at it by looking at C# first.

In C#, the code would be:
// In the Form's Load event, AFTER your data has been loaded:
this.MyCombo.SelectedIndexChanged += new EventHandler(MyCombo_SelectedIndexChanged);

// Then your eventhandler is simply:
private void MyCombo_SelectedIndexChanged(object sender, System.EventArgs e)
{
// code here
}
I think the corresponding VB code would be something like this:
' In the Form's Load event, AFTER your data has been loaded:
AddHandler Me.MyCombo.SelectedIndexChanged, AddressOf MyCombo_SelectedIndexChanged

// Then your eventhandler is simply:
Public Sub MyCombo_SelectedIndexChanged(ByVal sender As object, ByVal e as System.EventArgs)
' code here
End Sub
Hope that helps.

~~Bonnie




>Bonnie
>Thanks for responding, I will look into it. Currently I just use a try/catch in interactiveChange to circumvent the OLEDB errors when filling the dataset, but I did not like the solution.
>Vince
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform