DtP1337's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Active Members
Active Posts:
99 (0.46 per day)
Joined:
15-October 12
Profile Views:
645
Last Active:
User is offline Apr 23 2013 08:07 PM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
0
Icon   DtP1337 has not set their status

Posts I've Made

  1. In Topic: Driver's License Exam questions

    Posted 18 Apr 2013

    Is this the right way?

    
    Option Strict On
    
    Public Class Form1
    
        Private Sub btnScore_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnScore.Click
            Dim bool As Boolean
    
            If txt1.Text.ToLower = "a" Or txt1.Text.ToLower = "b" Or txt1.Text.ToLower = "c" Or txt1.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt2.Text.ToLower = "a" Or txt2.Text.ToLower = "b" Or txt2.Text.ToLower = "c" Or txt2.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt3.Text.ToLower = "a" Or txt3.Text.ToLower = "b" Or txt3.Text.ToLower = "c" Or txt3.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt4.Text.ToLower = "a" Or txt4.Text.ToLower = "b" Or txt4.Text.ToLower = "c" Or txt4.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt5.Text.ToLower = "a" Or txt5.Text.ToLower = "b" Or txt5.Text.ToLower = "c" Or txt5.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt6.Text.ToLower = "a" Or txt6.Text.ToLower = "b" Or txt6.Text.ToLower = "c" Or txt6.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt7.Text.ToLower = "a" Or txt7.Text.ToLower = "b" Or txt7.Text.ToLower = "c" Or txt7.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt8.Text.ToLower = "a" Or txt8.Text.ToLower = "b" Or txt8.Text.ToLower = "c" Or txt8.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt9.Text.ToLower = "a" Or txt9.Text.ToLower = "b" Or txt9.Text.ToLower = "c" Or txt9.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt10.Text.ToLower = "a" Or txt10.Text.ToLower = "b" Or txt10.Text.ToLower = "c" Or txt10.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt11.Text.ToLower = "a" Or txt11.Text.ToLower = "b" Or txt11.Text.ToLower = "c" Or txt11.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt12.Text.ToLower = "a" Or txt12.Text.ToLower = "b" Or txt12.Text.ToLower = "c" Or txt12.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt13.Text.ToLower = "a" Or txt13.Text.ToLower = "b" Or txt13.Text.ToLower = "c" Or txt13.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt14.Text.ToLower = "a" Or txt14.Text.ToLower = "b" Or txt14.Text.ToLower = "c" Or txt14.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt15.Text.ToLower = "a" Or txt15.Text.ToLower = "b" Or txt15.Text.ToLower = "c" Or txt15.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt16.Text.ToLower = "a" Or txt16.Text.ToLower = "b" Or txt16.Text.ToLower = "c" Or txt16.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt17.Text.ToLower = "a" Or txt17.Text.ToLower = "b" Or txt17.Text.ToLower = "c" Or txt17.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt18.Text.ToLower = "a" Or txt18.Text.ToLower = "b" Or txt18.Text.ToLower = "c" Or txt18.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt19.Text.ToLower = "a" Or txt19.Text.ToLower = "b" Or txt19.Text.ToLower = "c" Or txt19.Text.ToUpper = "d" Then
                bool = True
            ElseIf txt20.Text.ToLower = "a" Or txt20.Text.ToLower = "b" Or txt20.Text.ToLower = "c" Or txt20.Text.ToUpper = "d" Then
                bool = True
            Else
                bool = False
            End If
    
            If bool = True Then
                Answers()
    
            Else
                MessageBox.Show("Please only use the characters A,B,C, or D for answers.")
            End If
    
    
        End Sub
    
        Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
            txt1.Text = String.Empty
            txt2.Text = String.Empty
            txt3.Text = String.Empty
            txt4.Text = String.Empty
            txt5.Text = String.Empty
            txt6.Text = String.Empty
            txt7.Text = String.Empty
            txt8.Text = String.Empty
            txt9.Text = String.Empty
            txt10.Text = String.Empty
            txt11.Text = String.Empty
            txt12.Text = String.Empty
            txt13.Text = String.Empty
            txt14.Text = String.Empty
            txt15.Text = String.Empty
            txt16.Text = String.Empty
            txt17.Text = String.Empty
            txt18.Text = String.Empty
            txt19.Text = String.Empty
            txt20.Text = String.Empty
    
            lblCorrect.Text = String.Empty
            lblResults.Text = String.Empty
            lblPoF.Text = String.Empty
        End Sub
    
        Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
            Me.Close()
        End Sub
    
        Sub Answers()
            Dim strCorrectAnswers() As String = {"B", "D", "A", "A", "C", "A", "B", "A", "C", "D", "B", "C", "D", "A", "D", "C", "C", "B", "D", "A"}
    
            Const intLENGTH As Integer = 19
            Dim strAnswers(intLENGTH) As String
            Dim intStep As Integer
            Dim intCorrect As Integer
            Dim dblTotal As Double
            Dim strPoF As String
    
                strAnswers(0) = txt1.Text
                strAnswers(1) = txt2.Text
                strAnswers(2) = txt3.Text
                strAnswers(3) = txt4.Text
                strAnswers(4) = txt5.Text
                strAnswers(5) = txt6.Text
                strAnswers(6) = txt7.Text
                strAnswers(7) = txt8.Text
                strAnswers(8) = txt9.Text
                strAnswers(9) = txt10.Text
                strAnswers(10) = txt11.Text
                strAnswers(11) = txt12.Text
                strAnswers(12) = txt13.Text
                strAnswers(13) = txt14.Text
                strAnswers(14) = txt15.Text
                strAnswers(15) = txt16.Text
                strAnswers(16) = txt17.Text
                strAnswers(17) = txt18.Text
                strAnswers(18) = txt19.Text
                strAnswers(19) = txt20.Text
    
               
                For intStep = 0 To intLENGTH
                        If strAnswers(intStep).ToUpper = strCorrectAnswers(intStep) Then
                            intCorrect = intCorrect + 1
    
                        End If
                Next
        
    
            dblTotal = intCorrect / 20
    
            If dblTotal >= 0.5 Then
                strPoF = "Pass"
            Else
                strPoF = "Fail"
            End If
    
            lblResults.Text = dblTotal.ToString("P")
            lblCorrect.Text = intCorrect.ToString()
            lblPoF.Text = strPoF.ToString
    
        End Sub
    
    End Class
    
    
    
  2. In Topic: Driver's License Exam questions

    Posted 18 Apr 2013

    Well I kind of understand can you give me a visual example please?
  3. In Topic: Driver's License Exam questions

    Posted 17 Apr 2013

    View Postdday9, on 17 April 2013 - 02:17 PM, said:

    View PostDtP1337, on 17 April 2013 - 02:01 PM, said:

    Your loops seem to be very advanced to what I normally do in this class.


    If you don't want to do that, then you could just simply type out each individual control name.



    Controls as in txt1,txt2 ect?
  4. In Topic: Driver's License Exam questions

    Posted 17 Apr 2013

    Thanks guys I'm gonna fiddle and "learn" some more lol.
  5. In Topic: Driver's License Exam questions

    Posted 17 Apr 2013

    Your loops seem to be very advanced to what I normally do in this class. Could I create a loop to step through the TabIndex and check the text boxes that way? Otherwise would I just have to check the boxes individually?

    Your KeyPress Event handler seems like it work great. How would I do that after opening the keypress code? With the same code above that?

    Could I do the validation inside of the Answer sub?

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Programming Languages:
html, java, VB, some php,

Contact Information

E-mail:
Click here to e-mail me

Friends

DtP1337 hasn't added any friends yet.

Comments

DtP1337 has no profile comments yet. Why not say hello?