Hi good day guys i would just like to seek some help regarding my problem here in VB.NET. I have this program that if the text in the textbox is equal to the text in the label of the previous form it will add 1 for each correct answer but instead it always shows zero (0) (last form) and not showing the results that I want. Here is my code guys I hope you can help me with this problem thanks in advance.
Imports System.Convert
Imports System.IO
Public Class Form3
Private 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
Public Sub New2(ByVal callerInstance As Form4)
InitializeComponent()
' save the instance of the Me variable passed to this constructor
frm4 = 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
frm1 = New Form1
frm4 = New Form4
'program execution proper
Dim lbl3 As Integer = CInt(frm4.Label3.Text)
lbl3 = CInt(frm4.Label3.Text)
Dim Label22 As New Label
If frm1.TextBox2.Text = TextBox1.Text Then
lbl3 = CInt(lbl3) + 0 'if(integer.tryparse, lbl3) then lbl3 += 1
Dim Label24 As New Label
If Not frm1.TextBox4.Text = TextBox2.Text Then
lbl3 = CInt(lbl3) + 0
Dim Label26 As New Label
If Not frm1.TextBox6.Text = TextBox3.Text Then
lbl3 = CInt(lbl3) + 0
Dim Label28 As New Label
If Not frm1.TextBox8.Text = TextBox4.Text Then
lbl3 = CInt(lbl3) + 0
Dim Label30 As New Label
If Not frm1.TextBox10.Text = TextBox5.Text Then
lbl3 = CInt(lbl3) + 0
Dim Label32 As New Label
If Not frm1.TextBox12.Text = TextBox6.Text Then
lbl3 = CInt(lbl3) + 0
Dim Label34 As New Label
If Not frm1.TextBox14.Text = TextBox7.Text Then
lbl3 = CInt(lbl3) + 0
Dim Label36 As New Label
If Not frm1.TextBox16.Text = TextBox8.Text Then
lbl3 = CInt(lbl3) + 0
Dim Label38 As New Label
If Not frm1.TextBox18.Text = TextBox9.Text Then
lbl3 = CInt(lbl3) + 0
Dim Label40 As New Label
If Not frm1.TextBox20.Text = TextBox10.Text Then
lbl3 = CInt(lbl3) + 0 'frm4.Label3.Text = (frm4.Label3.Text) + 1
frm4.Show()
Me.Hide()
Else
lbl3 = CInt(lbl3) + 1 'Int((lbl3 = Convert.ToInt64(lbl3)) + 1)
frm4.Show()
Me.Hide()
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If frm4 IsNot Nothing Then
frm4.Visible = False
frm4.Show(Me) 'Show Second Form
Me.Hide()
End If
End Sub
End Class