Hi all,
I have this problem which i hope you can help me to solving ..
I have a listbox ,comboBox,textBox.
when i select an item from the listbox and then populate comboBox
and choose from it appere datain textbox..
the code is working fine in the first time ,,But when i try to select another item from list box this exception show up,,[Object reference not set to an instance of an object]
this Listbox code>>
private void stdlist_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
comboBox1.ItemsSource = null;
selectedId = ((DataRowView)stdlist.SelectedItem).Row.ItemArray[0].ToString();
adapter1 = new SqlDataAdapter("SELECT RESULTS.student_ID, STAGES.stage_name, RESULTS.test_ID FROM RESULTS INNER JOIN" +
" TESTS ON RESULTS.test_ID = TESTS.test_ID INNER JOIN " +
" STAGES ON TESTS.stage_ID = STAGES.stage_ID" +
" WHERE (RESULTS.student_ID = @student_ID) ORDER BY RESULTS.student_ID", connect);
adapter1.SelectCommand.Parameters.AddWithValue("@student_ID", selectedId);
dt1 = new DataTable();
adapter1.Fill(dt1);
comboBox1.ItemsSource = dt1.DefaultView;
the error in this code,,
private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
date.Text = "";
correctxt.Text = "";
falsetxt.Text = "";
mark.Text = "";
selectedTst = ((DataRowView)comboBox1.SelectedItem).Row.ItemArray[0].ToString();
the problem is ..I can't select another item from ListBox ..because the combobox is in handler..
how can i exit the handler?? i mean how can i select another item from ListBox??
thank you,,