Home » Category » Microsoft Visual Basic

Microsoft Visual Basic: Colour change

202| Tue, 05 Feb 2008 13:22:00 GMT| mojieboy| Comments (6)
I have created a simple interface, mainly using text boxes. How can i `grey out' the boxes after the user has entered the infomration ito each box.

Keywords & Tags: colour, change, microsoft, visual basic, vb

URL: http://www.programmerbase.com/visual-basic/80718/
 
«« Prev - Next »» 6 helpful answers below.
you can set the "Enabled" property to false. The makes the text grey and doesn't allow further input.

lotharhaensler | Sat, 10 Nov 2007 01:30:00 GMT |

If i want to set enabled to false after the user has entered data, how would i do this? How does the program know the text box is non-empty and therfore to be greyed out

mojieboy | Sat, 10 Nov 2007 01:32:00 GMT |

>How does the program know the text box is non-empty and therfore to be greyed out

if len(text1.text) > 0 then
text1.enabled = false
end if

lotharhaensler | Sat, 10 Nov 2007 01:33:00 GMT |

Hey, your good at this!

Do you mind if i ask you some more questions cos i am quite stuck. What i want to do is really quite easy in programming terms but i am not familiar with VB.

mojieboy | Sat, 10 Nov 2007 01:34:00 GMT |

>Do you mind if i ask you some more questions cos i am quite stuck.

Keep asking.
This forum is the right place for asking VB related questions.
If an answer has helped you, be sure to rate it.

lotharhaensler | Sat, 10 Nov 2007 01:35:00 GMT |

Here goes.

Basically i have created an interface. When the user starts to enter data, a timer is triggered. When the last bit of data is entered the timer stops. I want this time to be entered into the first place in an array. I then want this to be repeated 4 times (filling up the array), i know my code is naff and could use some hints as to my failing. Much appreciated.

'All variables MUST be declared
Option Explicit
'Declare the array
'First element of the array is Array1(1)
' Last element of the array is Array1(5)

Dim gArray1(1 To 5) As Integer
Dim elapsed As Long ' Private module variable

Private Sub Form_Load()
MsgBox "This is the first interface"
End Sub

Private Sub frmAddress_Change()
If Len(frmAddress.Text) > 0 Then
frmAddress.BackColor = &H80FF80
Else
frmAddress.BackColor = &HFFFFFF
End If

End Sub

Private Sub Timer1_Timer()
elapsed = elapsed + 1
End Sub

Private Sub Address_Click()
elapsed = 0
Timer1.Enabled = True
End Sub

Private Sub frmTotalPrice_Click()
Timer1.Enabled = False
Time.Text = elapsed
gArray1(1) = elapsed
ArrayContent.Text = gArray1(1)

End Sub

Private Sub cmdRetry_Click()

Dim counter
counter = 0

Do While counter < 4
Time.Text = " "
ArrayContent.Text = " "
frmInterface1.Show
counter = counter + 1
Loop

End
End Sub

mojieboy | Sat, 10 Nov 2007 01:36:00 GMT |

Microsoft Visual Basic Hot Answers

Microsoft Visual Basic New questions

Microsoft Visual Basic Related Categories