Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

disabling text box

Status
Not open for further replies.

M626

Programmer
Joined
Mar 13, 2002
Messages
299
Does anyone know how to disable a textbox so if a
command button is hit... it won't look for data in
that text box even if the code wants to look at that
text box for input.
 
If I understand the question correctly, give this a try:

Private Sub Command1_Click()
Text1.Enabled = Not Text1.Enabled
If Text1.Enabled Then
Print Text1.Text
End If
End Sub

Let me know if this is what you were looking for. If you choose to battle wits with the witless be prepared to lose.
[machinegun][hammer]
 
Thanks, that works

I also just set the boxes to contain values of 0 when i declared them as not visible.

Text33.Visible = False
Text34.Visible = False
Label39.Visible = False
Label40.Visible = False
Text33.Text = 0
Text34.Text = 0
 
Wow,

I don't know what you all have going, but it you are into 34 textboxes named text34 you should look into a control array. You could then use code like this

Private Sub Command1_Click()
Dim txt As TextBox

For Each txt In Text1
If Not txt.Visible Then txt.Text = "0"
Next
End Sub

where Text1 is the name of your control array. I also don't see why you would set the text property if the textbox is not visible? If you choose to battle wits with the witless be prepared to lose.
[machinegun][hammer]
 
We don't have 34 text boxes.. I just name it text34... I need the properity to be zero because there is a calculation occuring and the user has a chose to disable one of the text box, So they don't get confused... i just wanted to not display that text box but the calculation still needs a value in there or the prog crashes...
 
OK, I hope you don't think I was jumping, I was just trying to figure things out. [flip] If you choose to battle wits with the witless be prepared to lose.
[machinegun][hammer]
 
No, didn't thinking that at all... appricate the help though!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top