hi all;
I have place the following code in a OnSelectedIndexChanged sub..
Here is the code...
VB Code:
Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) LISTBOX2.ITEMS.CLEAR dim selectstring as string Dim cn1 As OleDbConnection = New OleDbConnection(ConfigurationSettings.appSettings("connectionstring")) cn1.Open() selectString = "select question_id, Question from questions where exam_id = " & listbox1.selecteditem.value Dim cmd1 As OleDbCommand = New OleDbCommand(selectString, cn1) Dim reader1 As OleDbDataReader = cmd1.ExecuteReader() dim liadd as listitem while(reader1.read()) liadd = new listitem liadd.text = reader1("question").tostring liadd.value = reader1("question_id").tostring listbox2.items.add(liadd) end while End Sub
But it doesn't work. As you can see it must refresh the values of a list box, but simply nothing happens...
Is there a mistake somewher ????
Thanks




Reply With Quote