我在form1 上有兩個文字盒這兩個問字和的數值我用陣列接收
我想要當我呼叫 form2 時 如果這兩個文字盒有值 就把他傳過
form2 並顯示 , 而我從form2連回 form1時 再輸入 做同樣的動作也可以 (也就是 我想要讓 form2上的 變數 去監控 form1 上的兩個文字盒)
這是我文字盒的寫法
Private Sub no1_Change()
If Len(no1.Text <> 0) Then
no(1) = no1.Text
Else
no(1) = 0
End If

End Sub

當我按下按鈕時連到 form2

Private Sub Command1_Click()
Dim i As Integer
For i = 1 To 2
Dim result As String
If (no(i) <> 0) Then
result = result + no(i)
End If
Form2.lblshow.Caption = result // 這裡我先用一個 label接收看看
Form2.show
Next
End Sub

在 form2 中 我也宣告一個陣列 想要去抓 form1 的文字盒值
Private Sub Form_Load()
Dim test(2) As Integer
Dim i As Integer
If (Form1.no(i) <> 0) Then
test(i) = no(i)
End If

End Sub

我想要把我抓到的值 (去抓 form1 文字盒的值) 顯示
Private Sub cmd2_Click()
Dim i As Integer
Dim stresult As String
For i = 1 To 2
stresult = stresult + test(i)
Next
lblshow.Caption = stresult
End Sub
可是一直抓不到說 想請問一下大家 我有那裡有錯呢
謝謝.........................
arrow
arrow
    全站熱搜

    vbqa 發表在 痞客邦 留言(2) 人氣()