|
-
Jul 14th, 2008, 02:00 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] if statment
What's wrong with this statment,
d Code:
If IDcountry.Text = "United States of America" Then
IDState.Enabled = True
If IDcountry.Text <> "United States of America" Then
IDState.Enabled = False
End If
End If
IDState is always enabled :S
thx
-
Jul 14th, 2008, 02:05 PM
#2
Frenzied Member
Re: if statment
is it enabled when it loads? if so what kind of control is IDCountry?
Pretty sure you were using dropdownlists but I may be mistaken... if you are try IDCountry.SelectedText
-
Jul 14th, 2008, 02:08 PM
#3
Re: if statment
Your if block is a bit of a paradox; the code that disabled the IDState field will execute when the IDcountry.Text field is both equal to "United States of America" and not equal to "United States of America".
Refactoring/correcting:
Code:
If IDcountry.Text = "United States of America" Then
''' Enable field
Else
''' Disable field
End If
''' Or...
IDState.Enabled = (IDcountry.Text = "United States of America")
I would suggest that you debug & step through the code next time
-
Jul 14th, 2008, 02:10 PM
#4
Frenzied Member
Re: if statment
you also might want to show us what event it supposed to be firing this code....
-
Jul 14th, 2008, 02:15 PM
#5
Thread Starter
Frenzied Member
Re: if statment
Yes they are dropdownlist.
well, it didn't work with .text , so i used
vb Code:
IDState.Enabled = (IDcountry.SelectedValue = "US")
and it works. But i don't know why it didn't work with the .text.
-
Jul 14th, 2008, 02:22 PM
#6
Re: if statment
did you checked with IDcountry.Text.Trim
__________________
Rate the posts that helped you 
-
Jul 14th, 2008, 02:28 PM
#7
Thread Starter
Frenzied Member
Re: if statment
works with trim
thx
-
Jul 14th, 2008, 02:34 PM
#8
Re: [RESOLVED] if statment
Glad it worked but best way is to go ahead with IDcountry.SelectedValue if needed add IDcountry.SelectedValue.Trim.
__________________
Rate the posts that helped you 
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
|