the actual problem is i want to populate data grid view depending upon combo box value but i want to hold the value in grid view when i click a value in combo box. but in my code when i select a value from combo box it shows into grid view but i click next value it shows next value but older one does not remain in grid view, am new so please guide me thoroughly Tnanks
private void Display_Load(object sender, EventArgs e)
{
string str = "SELECT i_id, i_name FROM sales";
comboBox1.DataSource = getData(str);
comboBox1.DisplayMember = "i_name";
comboBox1.ValueMember = "i_id";
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
int val;
Int32.TryParse(comboBox1.SelectedValue.ToString(), out val);
string str = "SELECT i_id, i_name, qty, rate,discount FROM sales WHERE i_id = " + val;
dataGridView1.DataSource = getData(str);
}