Question Displaying Results from Comparing texts from 2 forms

vbboy

New member
Joined
Feb 20, 2014
Messages
1
Programming Experience
Beginner
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

Public frm2 As Form2
Public frm4 As Form4

Public Sub New1(ByVal callerInstance As Form2)

InitializeComponent()

' save the instance of the Me variable passed to this constructor
frm2 = 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 frm2 As Form2 = Form2
Dim frm4 As Form4 = Form4
frm2 = New Form2
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 frm2.Label22.Text = TextBox1.Text Then
lbl3 = CInt(lbl3) + 1

Dim Label24 As New Label
ElseIf (TextBox2.Text = Form2.Label24.Text) Then
lbl3 = CInt(lbl3) + 1

Dim Label26 As New Label
ElseIf (frm2.Label26.Text = TextBox3.Text) Then
lbl3 = CInt(lbl3) + 1

Dim Label28 As New Label
ElseIf (frm2.Label28.Text = TextBox4.Text) Then
lbl3 = CInt(lbl3) + 1
Dim Label30 As New Label
ElseIf (frm2.Label30.Text = TextBox5.Text) Then
lbl3 = CInt(lbl3) + 1
Dim Label32 As New Label
ElseIf (frm2.Label32.Text = TextBox6.Text) Then
lbl3 = CInt(lbl3) + 1
Dim Label34 As New Label
ElseIf (frm2.Label34.Text = TextBox7.Text) Then
lbl3 = CInt(lbl3) + 1
Dim Label36 As New Label
ElseIf (frm2.Label36.Text = TextBox8.Text) Then
lbl3 = CInt(lbl3) + 1
Dim Label38 As New Label
ElseIf (frm2.Label38.Text = TextBox9.Text) Then
lbl3 = CInt(lbl3) + 1
Dim Label40 As New Label
ElseIf (frm2.Label40.Text = TextBox10.Text) Then
lbl3 = CInt(lbl3) + 1

frm4.Show()
Else
lbl3 = CInt(lbl3) + 1 'Int((lbl3 = Convert.ToInt64(lbl3)) + 1)
frm4.Show()
End If


If frm4 IsNot Nothing Then
frm4.Show() 'Show Second Form
Me.Hide()
End If

End Sub


End Class
 
Top Bottom