private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
comboBox2.Items.Clear();
comboBox2.Text = "";
if (comboBox1.SelectedIndex != -1)
{
var source = new AutoCompleteStringCollection();
string[] sValues = new string[0];
foreach (DataGridViewRow dr in dataGridView1.Rows)
{
if (!comboBox2.Items.Contains(dr.Cells[comboBox1.SelectedItem.ToString()].Value))
{
comboBox2.Items.Add(dr.Cells[comboBox1.SelectedItem.ToString()].Value);
Array.Resize(ref sValues, sValues.Length + 1);
sValues[sValues.Length - 1] = Convert.ToString(dr.Cells[comboBox1.SelectedItem.ToString()].Value);
}
}
source.AddRange(sValues);
comboBox2.AutoCompleteCustomSource = source;
}
}
Error is Value cannot be null. Parameter name: value
Loading

Vikram AgrawalPosted Apr 20, 2015, 5:19 AM
Hi Priyanka,
use SelectedText Property of combobox instead of SelectedItem and then compare it with combobox2
thanks
Akhil GargPosted Apr 20, 2015, 4:48 AM
priyanka bhatnagarPosted Apr 20, 2015, 2:58 AM
priyanka bhatnagarPosted Apr 20, 2015, 2:58 AM
Akhil GargPosted Apr 17, 2015, 1:28 PM
priyanka bhatnagarPosted Apr 17, 2015, 12:55 AM
Pankil BhattPosted Apr 16, 2015, 7:55 AM
please comboBox binding values. it's shows null value...