Hi all ,
I want to disable a text box when i select a value from drop down list, but im not able to so can u please help me

This is my code:

Protected Sub type_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles type.SelectedIndexChanged
If type.SelectedItem.Value = "Income" Then
vc.Enabled = False
Else
vc.Enabled = True
End If
End Sub

There could be a few problems. the best idea is to use the debugger to see what value the if statement is actually comparing. use F9 to create a break point and then just move through the code. The debugger is the most powerful tool available to any programmer.

but you also might want to try

type.SelectedValue.ToString() = "Income"

hope that helps 8-|

Hello Sir
Thanks for ur reply, Sir this also i have tried to do but not able to, the problem is i have a text box and dropdown box with 2 values income and expenses, when i select income value then then voucher number text box should be disabled and if i select expenses then voucher number text box should be enabled. Kindly help me.

Thanku in advance

This article has been dead for over six months. Start a new discussion instead.