The picture1 is one of the choices in the first question and it is the correct answer. So if the player clicked it, i will give him 1 point which i want to be placed at the label1. Actually my problem is solved i will just do it like this:
@Abe, your code will not work. You need to declare the sum first -
It still works without declaring sir ;)
Have a look at this, I included the code for the Picture controls.
Private Sub Command1_Click()
Sum = Val(Label1.Caption) + Val(Label2.Caption)
Label3.Caption = Str(Sum)
Private Sub Picture1_Click()
Label1.Caption = "1"
Private Sub Picture2_Click()
Label2.Caption = "1"
No it will not. If the OP starts with more advanced coding, he is going to fall into a pitfall, bugging his application. If we do give advice, we give the correct advice.:)
It still works without declaring sir
It will because "Sum" is a function within vb6. What if the OP uses it as a string, as you suggested? This means that if a user adds MyPic12345 it will be declared, as where an integer will throw an error, only wanting numbers, 12345. This is the correct way to make your application bug free.;)
@Abe, sir andre is right, we need to declare variables even if vb6 accept and run without declaring any variable. Try to put this code on the General Declaration area so you will not forget to declare your variables :D
You can also make vb6 automatically adds option explicit by going to Tools > Options > Editor Tab > then tick "Require Variable Declaration" > Ok.