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
Printable View
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
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
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:
I would suggest that you debug & step through the code next timeCode:If IDcountry.Text = "United States of America" Then
''' Enable field
Else
''' Disable field
End If
''' Or...
IDState.Enabled = (IDcountry.Text = "United States of America")
you also might want to show us what event it supposed to be firing this code....
Yes they are dropdownlist.
well, it didn't work with .text , so i used
and it works. But i don't know why it didn't work with the .text.vb Code:
IDState.Enabled = (IDcountry.SelectedValue = "US")
did you checked with IDcountry.Text.Trim
works with trim:)
thx
Glad it worked but best way is to go ahead with IDcountry.SelectedValue if needed add IDcountry.SelectedValue.Trim.