
A1.6 Adding a user-friendly interface with Visual Basic 17
A simple example, ox\dev\windows\vb\oxtest.vbp, illustrates the issues. It
has four buttons which each implement a different type of function call. The code is:
..........................................ox/dev/windows/vb/OxTest.frm (part of)
Private Sub Command1_Click()
Dim d1 As Double
Call RanSetRan("GM")
d1 = DRanU()
Text1.Text = d1
End Sub
Private Sub Command2_Click()
Dim d1 As Double
Text2.Text = DLogGamma(Text1.Text)
End Sub
Private Sub Command3_Click()
Dim Mat(4) As Double
Dim pmat As Long
Dim Res As Long
Mat(0) = Text3.Text
Mat(1) = Text4.Text
Mat(2) = Text5.Text
Mat(3) = Text6.Text
pmat = MatAllocBlock(2, 2)
Call MatCopyVecr(pmat, Mat(0), 2, 2)
Res = IInvert(pmat, 2)
Call VecrCopyMat(Mat(0), pmat, 2, 2)
Call MatFreeBlock(pmat)
Text3.Text = Mat(0)
Text4.Text = Mat(1)
Text5.Text = Mat(2)
Text6.Text = Mat(3)
End Sub
Private Sub Command4_Click()
Dim Vec(6) As Double
Dim VecAcf(6) As Double
Dim Res As Long
Vec(0) = 1
Vec(1) = 2
Vec(2) = 3
Vec(3) = 0
Vec(4) = 1
Vec(5) = 4
Res = IGetAcf(Vec(0), 6, 2, VecAcf(0), 0)
Text7.Text = VecAcf(0)
Text8.Text = VecAcf(1)
End Sub
.......................................................................................
Komentarze do niniejszej Instrukcji