你好,我想聊天,我在互联网上搜索,我终于找到了一些可能有用的东西。但现在我在名称处收到一个错误,它说在分配值之前使用了变量名称
代码:
Public Sub findForm1()
If Trim(Mid(My.Forms.Private1.Text, My.Forms.Private1.Text.Length - 2)) = formNo Then
My.Forms.Private1.RichTextBox1.Text = My.Forms.Private1.RichTextBox1.Text & poruka + vbCrLf
ElseIf Trim(Mid(My.Forms.Private2.Text, My.Forms.Private2.Text.Length - 2)) = formNo Then
My.Forms.Private2.RichTextBox1.Text = My.Forms.Private2.RichTextBox1.Text & poruka + vbCrLf
Else
If My.Forms.Private1.Visible = False Then
Dim name As String
For i As Integer = 1 To poruka.Length
If Mid(poruka, i, 2) = ": " Then
Exit For
name = name & Mid(poruka, i, 1)
End If
Next
My.Forms.Private1.Show()
My.Forms.Private1.Text = Trim(name) & " " & br
My.Forms.Private1.RichTextBox1.Text = My.Forms.Private1.RichTextBox1.Text & poruka + vbCrLf
Else
Dim name As String
For i As Integer = 1 To poruka.Length
If Mid(poruka, i, 2) = ": " Then
Exit For
End If
name = name & Mid(poruka, i, 1)
Next
My.Forms.Private2.Show()
My.Forms.Private2.Text = Trim(name) & " " & br
My.Forms.Private2.RichTextBox1.Text = My.Forms.Private2.RichTextBox1.Text & poruka + vbCrLf
End If
End If
formNo = Nothing
poruka = Nothing
End Sub
我该如何解决这个错误??我已经尝试移动结束 if 并将其他一些更改为结束 if。但仍然找不到正确的代码 PLEAS HELP。