Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21246

[RESOLVED] Code to seach for specific items in a listbox won't find anything?

$
0
0
Hello there everyone. I have borrowed code from a previous project. What it does is search a listbox for a phrase, then if it finds the phrase it will turn some buttons invisible.

VB Code:
  1. Public Sub CheckChoiceListStudent1()
  2. 'THIS CODE WILL CHECK TO SEE IF THE STUDENT HAS PICKED THE CHOICE YET
  3. ' IF THEY HAVE PICKED THE CHOICE, THEN IT WILL NOT BE VISIBLE
  4.  
  5.  
  6. 'CHECK FOR READ ON YOUR OWN
  7. Dim i1 As Long
  8.    
  9.     For i1 = StudentChoices(0).ListCount - 1 To 0 Step -1
  10. If InStr(UCase(StudentChoices(0).List(i1)), "Read On Your Own") Then
  11.         ReadToSelfBanner.Visible = False
  12.         ReadToSelfList.Visible = False
  13.         ReadSelfCountLBL.Visible = False
  14.      
  15.     End If
  16. Next
  17. End Sub


In this case the listbox is called StudentChoices(0), and checks for previous choices the student has made for literacy time. Example Read On Your Own. The choice is there in the listbox word for word, in the same upper and lower casing, but for some odd reason it will not find it, and turn the other stuff to be invisible. Have I screwed up trying to set up what to search for?

There is only one item in the StudentChoices(0) listbox at this time, which is Read On Your Own, so I am at a loss here. All help will definitely be appreciated!

Viewing all articles
Browse latest Browse all 21246

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>