Private Sub Command1_Click ()
Text3. Text=sum (Int (Text2. Text), Int (Text1. Text))
Command1. Caption=Text3. Text
End Sub
Module:
Public Function sum (As Integer x, y As an Integer) As String
Dim conn As New ADODB. Connection
Dim the rs As New ADODB. You
Conn. Open "driver={SQL server}; Server=XXJ \ XXXXXJ; The database=service; uid=sa; The PWD=1
"SQL="select * from number", "
Rs. The Open SQL, conn
The Set MSHFlexGrid1.
the DataSource=rsSum=MSHFlexGrid1. TextMatrix (x, y)
Rs. Close
Conn. Close
End the Function
Errors in the Set MSHFlexGrid1. The DataSource=rs
I put the module of code in the from can run what went wrong in the
Private Sub Command1_Click ()
Dim conn As New ADODB. Connection
Dim the rs As New ADODB. You
Conn. Open "driver={SQL server}; Server=XXJ \ XXXXXJ; The database=service; uid=sa; The PWD=1 "connect to the database
SQL="select * from number", "
Rs. The Open SQL, conn
The Set MSHFlexGrid1.
the DataSource=rsText3. Text=MSHFlexGrid1. TextMatrix (Int (Text2. Text), Int (Text1. Text))
Rs. Close
Conn. Close
End Sub
CodePudding user response:
To solve the add Form1 to the front.CodePudding user response:
MSHFlexGrid1 is a "control", the name of the "visual objects" must be attached to a particular form,To operate this kind of object, certainly must indicate the name of the corresponding form,
Use the format of the statement, basically all is such a format:
The form name.
control name. AttributeForm. Method control name.
(" method "refers to the procedure or function, if you need parameters, transfer the corresponding parameter to call)
CodePudding user response:
You use Form1 control MSHFlexGrid1 inside the module, front without Form1. Again, it must be an errorCodePudding user response:
MSHFlexGrid1 this is no longer in your moduleYou don't add FORM1?
He knows that you quoted?
CodePudding user response:
A small problem, the ga ga ga ga feasting on