Current location: Hot Scripts Forums » Programming Languages » Visual Basic » pls HELP VB 5.0 colour change


pls HELP VB 5.0 colour change

Reply
  #1 (permalink)  
Old 12-05-04, 05:01 AM
K Z K Z is offline
New Member
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
pls HELP VB 5.0 colour change

Hi Forum

since Friday Im trying to figure out that F*** homework:

1. change 4 colours at certain interval
2. start the changes with Command Button 1
3. stop the changes with Command Button 2
4. Interval should be variable (TextBox 1)

and if I configure it so, that this interval will be Xtimes longer (probably Text Box2) I will get extra points from our sadist teacher.

until now I have that rubbish:

Quote:
Private Sub Command1_Click()
Picture1.BackColor = RGB(0, 0, 0)
End Sub

Private Sub Form_Load()
Text1.Text = ""
Timer1.Interval = Val(Text1.Text)
End Sub

Private Sub Picture1_Click()

End Sub

Private Sub Text1_Change()
If Text1.Text > "0" Then
Command1.Enabled = True
Else
Command1.Enabled = False
End If
If Text1.Text > "0" Then
Timer1.Enabled = True
Else
Timer1.Enabled = False
End If
End Sub

Private Sub Timer1_Timer()
If Picture1.BackColor = RGB(0, 0, 0) Then
Picture1.BackColor = RGB(0, 0, 200)
Else
Picture1.BackColor = RGB(0, 0, 0)
End If
End Sub
When I write in the
Quote:
Private Sub Form_Load()
Text1.Text = ""
Timer1.Interval = Val(Text1.Text)
End Sub
Text1.Text = "" it doesnt work, but when I type Text1.Text = 100 the colours changes.

PLS can someone helps me?
Reply With Quote
  #2 (permalink)  
Old 12-10-04, 02:19 AM
lycoo lycoo is offline
New Member
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
'replace Text1_Change and try
Private Sub Text1_Change()
If Text1.Text > "0" Then
Command1.Enabled = True
Else
Command1.Enabled = False
End If
'------------------------------------
If Trim(Len(Text1.Text)) > 0 Then
Timer1.Interval = CInt(Text1.Text)
Else
Timer1.Interval = 0
End If
'------------------------------------
End Sub
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 09:55 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.