Private Sub Command1_Click()
Frame1.Caption = Text1.Text
    Frame2.Caption = Text2.Text
    Text3.Text = ""
    Text4.Text = ""
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command3_Click(Index As Integer)
Text3.Text = Val(Text3.Text) + 1

End Sub

Private Sub Command4_Click(Index As Integer)
Text4.Text = Val(Text4.Text) + 1
End Sub


Public Sub Label1_Change()
If Text3.Text > Text4.Text Then
    Label1.Caption = "Player1 is leading!"
ElseIf Text4.Text > Text3.Text Then
    Label1.Caption = "Player2 is leading!"
ElseIf Text3.Text = Text4.Text Then
    Label1.Caption = "Tough game!"
End If
End Sub

whats wrong with this scoreboard?

Recommended Answers

All 16 Replies

When the event Label1_Change() fires, as you are not changing the Caption of the label1 any where other than the change event of itself.

When the event Label1_Change() fires, as you are not changing the Caption of the label1 any where other than the change event of itself.

-ty
-the error said there were some procedure/event having the same name., i dont get it./

Is this your complete code ?

Is this your complete code ?

yeah.,or do i need more?

Which line in your code is throwing error ?

Which line in your code is throwing error ?

Private Sub Command1_Click()
Frame1.Caption = Text1.Text
Frame2.Caption = Text2.Text
Text3.Text = ""
Text4.Text = ""
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

[B]Private Sub Command3_Click(Index As Integer)[/B]
Text3.Text = Val(Text3.Text) + 1

End Sub

Private Sub Command4_Click(Index As Integer)
Text4.Text = Val(Text4.Text) + 1
End Sub


Public Sub Label1_Change()
If Text3.Text > Text4.Text Then
Label1.Caption = "Player1 is leading!"
ElseIf Text4.Text > Text3.Text Then
Label1.Caption = "Player2 is leading!"
ElseIf Text3.Text = Text4.Text Then
Label1.Caption = "Tough game!"
End If
End Sub

Have you created a control array ?

Have you created a control array ?

i don't know what a control array means.,,i'm just tryin whta i know to be advance,. i didn't know this cou'ld be that uneasy,.ty

Why click event of Command 3 and 4 shows (Index As Integer) ,while command 1 and 2 does not. That means you are using control arrays unknowingly.

Did you copied an pasted command buttons on your form ?

Why click event of Command 3 and 4 shows (Index As Integer) ,while command 1 and 2 does not. That means you are using control arrays unknowingly.

Did you copied an pasted command buttons on your form ?

-i did not., i just typed it the usual way.,ty

As i have already mention your code shows you are using control array of command buttons.

If you do not want to accept your mistake and do not want to learn anything, God bless you.

commented: :) +15

As i have already mention your code shows you are using control array of command buttons.

If you do not want to accept your mistake and do not want to learn anything, God bless you.

im sorry.,
i didn't copy pasted anything.,i just didn't realized there was control array

Remove the Index As Integer in line 12 and 17 like this;

Private Sub Command3_Click()

and this,

Private Sub Command4_Click()

respectively, and it shall set you free ;)

and debasisdas is right to remove the accidental array, do the following;
1. click on Command 3button in the properties window goto index and delete anything found therein (so that is becomes empty)
2. do the same for Command 4.

i just didn't realized there was control array

That is what i was trying to explain you from last 2 days.

That is what i was trying to explain you from last 2 days.

now i am enlightened! ty2 : )

now i am enlightened! ty2 : )

Private Sub Command1_Click()
MsgBox "haha!! duh!"
Unload Me
End Sub
Private Sub Form_Load()
Me.Top = (Screen.Height - Me.Height) / 2
Me.Left = (Screen.Width - Me.Width) / 2
End Sub
Private Sub Text1_Change()

If Text1.Text = "1" Then
MsgBox "Bingo!", vbInformation, "success"
Form2.Show
Unload Me
Else
MsgBox "Try again...Your time is fucking off!", vbCritical, "Wrong"
Text1.Text = " "
End If
End Sub
Private Sub Timer1_Timer()
Dim count, ihap As Integer
count = Val(Label2.Caption)
ihap = 5
If count <> ihap Then
count = count + 1
Label2.Caption = count
Else
MsgBox "Your time is fucked up!"
Unload Me
End If
End Sub


i'm really a sucker at this

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.