-
Mar 12th, 2014, 05:19 PM
#1
Thread Starter
Addicted Member
combobox1.text is not = "YES" or "NO" or "Maybe"
Last edited by KRENAR; Dec 5th, 2014 at 06:11 AM.
-
Mar 12th, 2014, 05:39 PM
#2
Re: combobox1.text is not = "YES" or "NO" or "Maybe"
I'd be inclined to look at SelectedIndex rather than the .Text. It would make for an easier comparison. How many different answers are you allowing the user to select from anyways? Yes, No, and Maybe seem to cover every situation.
My usual boring signature: Nothing
-
Mar 12th, 2014, 06:15 PM
#3
Re: combobox1.text is not = "YES" or "NO" or "Maybe"
Code:
If ComboBox1.Text <> "YES" AndAlso ComboBox1.Text <> "NO" AndAlso ComboBox1.Text <> "MAYBE" Then
MessageBox.Show("Exit Sub")
End If
-
Mar 12th, 2014, 06:28 PM
#4
Thread Starter
Addicted Member
Re: combobox1.text is not = "YES" or "NO" or "Maybe"
Last edited by KRENAR; Dec 5th, 2014 at 06:11 AM.
-
Mar 12th, 2014, 06:39 PM
#5
Thread Starter
Addicted Member
Re: combobox1.text is not = "YES" or "NO" or "Maybe"
Last edited by KRENAR; Dec 5th, 2014 at 06:11 AM.
-
Mar 12th, 2014, 08:57 PM
#6
Re: combobox1.text is not = "YES" or "NO" or "Maybe"
If you set the combobox DropDownStyle property to DropdownList, the user can't enter anything, they must select from the list.
-
Mar 12th, 2014, 10:27 PM
#7
Fanatic Member
Re: combobox1.text is not = "YES" or "NO" or "Maybe"
Originally Posted by wes4dbt
If you set the combobox DropDownStyle property to DropdownList, the user can't enter anything, they must select from the list.
Yeah, that's definately what should be in your case. Also set Text property of ComboBox to your first value to avoid empty input.
God, are you punishing me because my hair is better than yours? -Jack Donaghy
-
Mar 13th, 2014, 12:22 AM
#8
Re: combobox1.text is not = "YES" or "NO" or "Maybe"
try this:
Code:
MsgBox(New String() {"YES", "NO", "Maybe"}.All(Function(s) ComboBox1.Text <> s))
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 13th, 2014, 12:27 AM
#9
Re: combobox1.text is not = "YES" or "NO" or "Maybe"
MsgBox(New String() {"YES", "NO", "Maybe"}.All(Function(s) ComboBox1.Text <> s))
Don't mean to hijack this thread but I would like to know how this works. What is "s" and why are you using Msgbox instead of MessageBox
-
Mar 13th, 2014, 12:34 AM
#10
Re: combobox1.text is not = "YES" or "NO" or "Maybe"
Code:
Dim a() As String = {"YES", "NO", "Maybe"}
'a.All(Function(s) ComboBox1.Text <> s)
'is equivalent to:
For Each s As String In a
Next
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 13th, 2014, 12:35 AM
#11
Re: combobox1.text is not = "YES" or "NO" or "Maybe"
Originally Posted by wes4dbt
and why are you using Msgbox instead of MessageBox
because it's shorter + I always have
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 13th, 2014, 12:46 AM
#12
Re: combobox1.text is not = "YES" or "NO" or "Maybe"
.Paul, thanks
Learn something new everyday.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|