I have an application program to submit help tickets. The problem is the error messages are only supposed to pop up when someone doesn't format it correctly but it either don't or comes up after typing when there is no errors. The next issue is my msgbox for lblvalidate doesn't even show up when you hit submit. Can someone please help me?
Here's the code:
' Program Name: Help Desk Request
' Author: Corinne Hosington
' Date: February 22, 2017
' Purpose: This web application allows college staff to fill in a web form requesting help from a computer help desk.
Option Strict On
Partial Class _Default
Inherits Page
Protected Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click
' This btnSubmit_Click event will place a help ticket for users submitting requests.
' Declare and Initialize Variables
Dim strMessage As String
Dim strFName As String
Dim strLName As String
Dim strEmail As String
Dim intPhone As Integer
Dim intLabNum As Integer
Dim intCompStat As Integer
' Trim additional spaces that are entered by the user
strFName = txtFName.Text.Trim
strLName = txtLName.Text.Trim
strEmail = txtEmail.Text.Trim
lblValidate.Text = ""
If (strFName = "") Then
rfvFName.Visible = True
Else
rfvFName.Visible = False
If (strLName = "") Then
rfvLName.Visible = True
Else
rfvLName.Visible = False
End If
If (strEmail = "") Then
revEmail.Visible = True
Else
revEmail.Visible = False
End If
If (intPhone <= 9) Then
revPhone.Visible = True
Else
revPhone.Visible = False
End If
If (intLabNum >= 15) Then
rfvLabNum.Visible = True
Else
rfvLabNum.Visible = False
End If
If (intCompStat >= 30) Then
rfvCompStat.Visible = True
Else
rfvCompStat.Visible = False
End If
strMessage = "An order has been placed for " & "<br>" _
& strFName & strLName & "<br>"
strMessage = "Email address: " & strEmail & "<br>" strMessage = "Phone: " & intPhone & "<br>" strMessage = "Lab number " & intLabNum & "<br>" & " and " & "station number " & intCompStat
lblValidate.Text = strMessage
End If
End Sub
End Class
Sorry its not formatted the way it is in VS but I tried to fix it and thats the best I could do.