当我点击表格上的按钮时,什么都没发生。我几乎尝试了所有的故障排除,但没有任何反应。我是新手请帮帮我们。在此先感谢专家。
Imports System.Convert
Imports System.IO
Public Class Form3
Inherits System.Windows.Forms.Form
Public frm1 As Form1
Private frm4 As Form4
Public Sub New1(ByVal callerInstance As Form1)
InitializeComponent()
' save the instance of the Me variable passed to this constructor
frm1 = callerInstance
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim frm1 As Form1 = Form1
Dim frm4 As Form4 = Form4
'program execution proper
Dim lbl3 As Integer = CInt(frm4.Label3.Text)
If Not String.Equals(frm1.TextBox2.Text.Trim(), TextBox1.Text.Trim(), StringComparison.InvariantCultureIgnoreCase) Then
lbl3 = (lbl3) + 1
frm4.Label3.Text = CStr(lbl3)
If Not String.Equals(frm1.TextBox4.Text.Trim(), TextBox2.Text.Trim(), StringComparison.InvariantCultureIgnoreCase) Then
lbl3 = (lbl3) + 1
frm4.Label3.Text = CStr(lbl3)
If Not String.Equals(frm1.TextBox6.Text.Trim(), TextBox3.Text.Trim(), StringComparison.InvariantCultureIgnoreCase) Then
lbl3 = (lbl3) + 1
frm4.Label3.Text = CStr(lbl3)
If Not String.Equals(frm1.TextBox8.Text.Trim(), TextBox4.Text.Trim(), StringComparison.InvariantCultureIgnoreCase) Then
lbl3 = (lbl3) + 1
frm4.Label3.Text = CStr(lbl3)
If Not String.Equals(frm1.TextBox10.Text.Trim(), TextBox5.Text.Trim(), StringComparison.InvariantCultureIgnoreCase) Then
'frm4.Label3.Text = (frm4.Label3.Text) + 1
frm4.Label3.Text = CStr(lbl3)
If Not String.Equals(frm1.TextBox12.Text.Trim(), TextBox6.Text.Trim(), StringComparison.InvariantCultureIgnoreCase) Then
lbl3 = (lbl3) + 1
frm4.Label3.Text = CStr(lbl3)
If Not String.Equals(frm1.TextBox14.Text.Trim(), TextBox7.Text.Trim(), StringComparison.InvariantCultureIgnoreCase) Then
lbl3 = (lbl3) + 1
frm4.Label3.Text = CStr(lbl3)
If Not String.Equals(frm1.TextBox16.Text.Trim(), TextBox8.Text.Trim(), StringComparison.InvariantCultureIgnoreCase) Then
lbl3 = (lbl3) + 1
frm4.Label3.Text = CStr(lbl3)
If Not String.Equals(frm1.TextBox18.Text.Trim(), TextBox9.Text.Trim(), StringComparison.InvariantCultureIgnoreCase) Then
lbl3 = (lbl3) + 1
frm4.Label3.Text = CStr(lbl3)
If Not String.Equals(frm1.TextBox20.Text.Trim(), TextBox10.Text.Trim(), StringComparison.InvariantCultureIgnoreCase) Then lbl3 += 1
lbl3 = (lbl3) + 1
frm4.Label3.Text = CStr(lbl3)
If frm1.Label1.Text = TextBox9.Text Then
lbl3 += 0
frm4.Show(Me)
Me.Hide()
Else
lbl3 = (lbl3) + 0
frm4.Label3.Text = CStr(lbl3)
frm4.Show(Me)
Me.Hide()
End If
If frm4 IsNot Nothing Then
frm4.Visible = False
frm4.Show(Me) 'Show Second Form
Me.Hide()
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End Sub
End Class
答案 0 :(得分:0)
我通过移除frm4.show(Me)
上的“我”将其更改为frm4.show()
因为我在按钮点击事件的句柄上声明了两个表单。