if txtNaam.text = "O?:" & lstGekozenOpties.List(i) Then
the ? must represent one! letter. Must I use ? or * or something else ?
Printable View
if txtNaam.text = "O?:" & lstGekozenOpties.List(i) Then
the ? must represent one! letter. Must I use ? or * or something else ?
wait what letter do you want ? to represent there is 26 :P
You need to use Like instead of Equals to(=)
if txtNaam.text Like "O?:" & lstGekozenOpties.List(i) Then
You don't NEED TO the only problem here is that he hasn't stated everything
Any of them.. he wants "?" to represent a wild card!Quote:
Originally Posted by Hell-Lord
Here is one way (I have had a few...):
VB Code:
Option Explicit Const ALPHABET As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" Private Sub Command1_Click() If Left$(txtNaam.Text, 1) = "O" And InStr(1, ALPHABET, Mid$(txtNaam.Text, 2, 1), vbTextCompare) And Mid$(txtNaam.Text, 3, 1) = ":" Then If Mid$(txtNaam.Text, 4, Len(txtNaam.Text) - 4) = lstGekozenOpties.List(i) Then 'Do something End If End If End Sub
Hmmm overkill ;) - try this:
Use Like() to pattern match.
VB Code:
If UCase(txtNaan.Text) Like ("O[ABCDEFGHIJKLMNOPQRSTUVWXYZ]:" & UCase(lstGekozenOpties.List(i))) Then 'Do stuff End If