Results 1 to 5 of 5

Thread: OnSelectedIndexChanged Doesn't work *Resolved*

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    56

    OnSelectedIndexChanged Doesn't work *Resolved*

    hi all;
    I have place the following code in a OnSelectedIndexChanged sub..

    Here is the code...
    VB Code:
    1. Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs)
    2. LISTBOX2.ITEMS.CLEAR
    3. dim selectstring as string
    4. Dim cn1 As OleDbConnection = New OleDbConnection(ConfigurationSettings.appSettings("connectionstring"))
    5. cn1.Open()
    6. selectString  = "select question_id, Question from questions where exam_id = " & listbox1.selecteditem.value
    7. Dim cmd1 As OleDbCommand = New OleDbCommand(selectString, cn1)
    8. Dim reader1 As OleDbDataReader = cmd1.ExecuteReader()
    9. dim liadd as listitem
    10.  
    11. while(reader1.read())
    12. liadd = new listitem
    13. liadd.text = reader1("question").tostring
    14. liadd.value = reader1("question_id").tostring
    15. listbox2.items.add(liadd)
    16. end while
    17. 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
    Last edited by ahmedabugh; May 12th, 2005 at 12:45 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width