Home > Software engineering >  Why didn't single button as a result,, every brother please help
Why didn't single button as a result,, every brother please help

Time:09-18

Private Sub Form_Click ()
% % Dim a, b
A=3: b=4
Call s (a, b)
Print a, b
End Sub
Private Sub s (As an Integer x, y As an Integer)
X=x * 100
Y=y * 100
End Sub

CodePudding user response:

Add:
Private Sub Command1_Click ()
Form_Click
End Sub

Or simply to
Private Sub Command1_Click ()
% % Dim a, b
A=3: b=4
Call s (a, b)
Print a, b
End Sub

CodePudding user response:

Your code:
Form_Click () the process, is "click on the form" trigger event (in the form customer zone, no control click),
You click on the "button", but no corresponding code "events", of course look would be "no response",

In the forms designer, double-click the "button", VB6 code automatically pop-up window, to give you "set event procedure code framework",
You only need to the corresponding Privete Sub... End, between Sub need to write good code,

CodePudding user response:

It is recommended that you draw a button, and then click the button response code written,

CodePudding user response:

If you have a form button control (for), you can click on the control must have no reaction, because of your statement is click form events,
Put the content in the click event of the button control inside the
% % Dim a, b
A=3: b=4
Call s (a, b)
Print a, b

Private Sub Command1_Click ()
Here
End Sub

If you click the form namely originally, that is because the form the upper left corner the other controls keep out?
Or to Print a, b to Me. The Caption=a & amp; "/" & amp; B, according to the results to form the title on a try,

CodePudding user response:

Private Sub Form_Click ()
% % Dim a, b
A=3: b=4
Call s (a, b)
Print a, b
End Sub
Private Sub s (byref x As an Integer, byref y As an Integer)
X=x * 100
Y=y * 100
End Sub

CodePudding user response:

The
refer to the original poster qq_40789800 response:
Private Sub Form_Click ()
% % Dim a, b
A=3: b=4
Call s (a, b)
Print a, b
End Sub
Private Sub s (As an Integer x, y As an Integer)
X=x * 100
Y=y * 100
End Sub

LZ code is all error, but the VB Form AutoRadraw attribute is not set to True, causes the Form does not display the content,
AutoRedraw properties, return or to persistent graphics Settings from the graphic method. The output of the,


Needs in the form properties page Settings, or in the form of the Load time to add 1:
Me. Show
 Private Sub Form_Load () 
Me. Show
End Sub

Private Sub Form_Click ()
% % Dim a, b
A=3: b=4
Call s (a, b)
Print a, b
End Sub

Private Sub s (As an Integer x, y As an Integer)
X=x * 100
Y=y * 100


CodePudding user response:

Your code is written in the click on the form, you click the button of course no response
  • Related