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
priyanka bhatnagar
1.7k
48
10.2k
Getting error in my c# code please help
Apr 16 2015 7:17 AM
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
Reply
Answers (
7
)
how to make a sequence in click in button click event
Help me.. C#.. I really don't know how to do this..