TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Scott Stewart
1.6k
189
18k
Filling a combobox in a toolbar from a value in another combobox
Mar 6 2012 6:36 PM
I ahev a combobox in the toolbar for States. It is loaded when the MDI Form loads. When the user selects the state another combobox in the Toolbar should be loaded with Counties in the selected state. I added two table adapters and edited the Counties SQL so I could find it in code. But no luck. I am not sure what the relationship is. I tired MSDN Reference and did several searches, but I didn't find an explanation (I still need to find a good book). So here is the code I have;
[code]
private void tblStatesComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
// Need to get the value of the StateID and use it in the SQL for this Combobox
private long lngStateID;
private string strSQL;
lngStateID=this.tblStatesComboBox.SelectedValue;
//strSQL="SELECT CountyName, CountyID FROM Counties WHERE StateID=" + lngStateID + " ORDER BY CountyName ASC";
//Stuff the sql into the right place for the combobox and execute the fill.
this.tblCountiesTableAdapter.Fill(this.newLandmanDataSet.tblCounties);
}
[/code]
That's what I want to do, but I can't find trhe right properties in code and can't figure out how to execute the SQL on the second combobox.
Reply
Answers (
14
)
Crystal Report viewer sample using C# code in vs2010
Code analysis