private void button1_Click(object sender, EventArgs e)
{
resultBindingSource1.DataSource = from result in ds.Results where result.REGISTRATION_NUMBER == textBox1.Text && result.EXAM_YR == comboBox1.SelectedItem select result;
}
The above code works perfectly when i click button1 to to filter the datasource.
Please i need an error message box to pop up if the textbox and combobox are empty or the values are incorrect
Thanks
Loading

Christian NwambaPosted Sep 4, 2013, 3:49 PM
Sanjeeb LenkaPosted Sep 4, 2013, 5:24 AM
private void button1_Click(object sender, EventArgs e)
{
if(textBox1.Text!=String.Empty && comboBox1.SelectedText!=String.Empty)
{
var res = from result in ds.Results where result.REGISTRATION_NUMBER == textBox1.Text && result.EXAM_YR == comboBox1.SelectedItem select result;
if(res!=null)
resultBindingSource1.DataSource=res;
else
MessageBox.Show("no data found");
}
else
{
MessageBox.Show("Enter details");
}
}
Christian NwambaPosted Sep 4, 2013, 3:47 AM
Thanks for your help
Sanjeeb LenkaPosted Sep 4, 2013, 1:32 AM
private void button1_Click(object sender, EventArgs e)
{
if(textBox1.Text!=String.Empty && comboBox1.SelectedText!=String.Empty)
{
resultBindingSource1.DataSource = from result in ds.Results where result.REGISTRATION_NUMBER == textBox1.Text && result.EXAM_YR == comboBox1.SelectedItem select result;
}
else
{
MessageBox.Show("Enter details");
}
}