Solved

Selection driven combos

Posted on 2006-11-15
2
234 Views
Last Modified: 2010-04-16
Hi,

I have 2 c# winform dot net 1.1 combo's. Both are data bound to the results of a SQL select statement executed on my sybase database. What I want to do is implement functionality where by selecting one of the values in combo1 forces the selected index of combo2 to be changed and display a different value by default, but allow the user to edit the selected index of combo 2 if need be.

Is this possible. As ever your help is really appreciated.

Thanks
0
Comment
Question by:bowemc
  • 2
2 Comments
 
LVL 15

Accepted Solution

by:
ozymandias earned 55 total points
ID: 17948186
create a method like this :

private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e) {
     // set the selected index of comboxbox2 to what ever you like here
}

and bind it to the selectedInbdexChanged event like this :

this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
0
 
LVL 15

Expert Comment

by:ozymandias
ID: 17948197
Using the above, whenever the selected index of comboxbox1 chnages the method will be called and you can set the selectedindex of combobox2 accordingly.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

822 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question