Click here to Skip to main content
15,891,764 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
for example;
ı will select in combobox week of 5 and will bring me in datagridview value week5,
ı will select in combobox week of 6 and will bring me in datagridview value week6
and what it show in combobox value will be value in datagridview to.
thanks for help
Posted

1 solution

Tr use like..
C#
private void ComboBox1_SelectedIndexChanged(object sender,System.EventArgs e)
{
string Val=ComboBox1.SelectedValue;
//get datatable corresponding with the Val e.g 5,6 etc and then fill grid here
}

ref.
https://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.selectedindexchanged(v=vs.110).aspx[^]
http://csharpdotnetfreak.blogspot.com/2009/02/ajax-cascading-dropdownlist-database.html[^]
http://www.aspsnippets.com/Articles/Creating-Cascading-DropDownLists-in-ASP.Net.aspx[^]
 
Share this answer
 
Comments
ibrahim-34 30-Jan-15 4:37am    
ı put 1 combo and 2 tab_contorl with datagrid.one tab is approved and one tab is unapproved.when ı select week of 5 it is bring value unapproved, when ı select week of 6 it is bringing unapproved to.but when ı click tab approved and return click unapproved in combo value is showing 6 but in datagrid bringing value week of 5.
/\jmot 30-Jan-15 4:42am    
use Improve solution to update your question.
post your code .
ibrahim-34 30-Jan-15 4:49am    
if (tabControl1.SelectedIndex == 1)
{

ada = new SqlDataAdapter("", con);
dt = new DataTable();
ada.Fill(dt);
dataGrid1.DataSource = dt;


}
ibrahim-34 30-Jan-15 4:51am    
when ı click in combo week of 6 then ı click tab approved and return click unapproved in combo value is showing 6 but in datagrid bringing value week of 5.how to make for what is the showing in combo value and in datagrid value is the same?
/\jmot 30-Jan-15 5:14am    
use..
void tabControl1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (e.Source is TabControl)
{
//do work when tab is changed
}
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900