Results 1 to 18 of 18

Thread: [RESOLVED]Problem regarding listbox and textbox

Threaded View

  1. #1

    Thread Starter
    New Member SOMALIA's Avatar
    Join Date
    Apr 2012
    Posts
    8

    [RESOLVED]Problem regarding listbox and textbox


    As you can see at the above picture, im trying to make a program in which if the textbox text and the listbox text are the same order, which they are in the picture, a bluie fonted text saying well done appears. However only the red text appears which is only meant to come when the order of the text in both listbox and textbox isnt the same.

    Here is the code that i used for this:
    listarrays = name of listbox
    textbox1 = name of textbox
    l is the name of the label for correct answer(blue font)
    label3 is name of label with red font which should only appear for wrong answer



    Code:
     Dim text As String = Me.TextBox1.Text
            For Each item As Object In listarrays.Items
                If item.ToString = Me.TextBox1.Text Then
                    l.Visible = True
                Else
                    Label3.Visible = True
                End If
            Next
    Some people told me to use another textbox instead of the listbox but thats just making itmuch harder for me as I already made the full code working with the listbox. My lecturer told me i need to convert both in string so both textbox and listbox are compatible and i did so (see code above) but the correct label doesnt show;p

    Any help would be appreciated
    Last edited by SOMALIA; Apr 27th, 2012 at 10:22 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