Hey guys, I am having trouble with this If satement. heres the code that i have so far:
If Val(TextBox1.Text) = Val(TextBox3.Text) And Val(TextBox2.Text) = Val(TextBox4.Text) Then
Label6.Text = "Students share 2 Subjects"
End If
If Val(TextBox1.Text) = Val(TextBox4.Text) And Val(TextBox2.Text) = Val(TextBox3.Text) Then
Label6.Text = "Students share 2 Subjects"
End If
If Val(TextBox1.Text) = Val(TextBox3.Text) Or Val(TextBox2.Text) = Val(TextBox4.Text) Then
Label6.Text = "Students share 1 Subject"
If Val(TextBox2.Text) = Val(TextBox3.Text) Or Val(TextBox1.Text) = Val(TextBox4.Text) Then
Label6.Text = "Students share 1 Subject"
End If
End If
If Val(TextBox1.Text) <> Val(TextBox3.Text) And Val(TextBox2.Text) <> Val(TextBox4.Text) Then
Label6.Text = "Students share 0 subjects"
End If
If Val(TextBox1.Text) <> Val(TextBox4.Text) And Val(TextBox2.Text) <> Val(TextBox3.Text) Then
Label6.Text = "Students share 0 subjects"
End If
And here's what im trying to achieve (DL pic file attatchment). So If the two subject codes are the same the label is meant to read "students share 2 subjects" and if only one subject code matches then the label is meant to read "students share 1 subject" and if no subjects match then "students share 0 subjects".
I haven't named the textboxes or labels yet, so TextBox1 and TextBox2 are the subjects of Student 1 and TextBox3 and TextBox4 are the subjects of Student 2. Label6 is wehre the "students share x subject(s)"!!
Thank you very much for any help....I'm new to vb.net and appreciate any help given, Thank you very much!!!!