I usually deal with front end stuff involving just xhtml and css, but I've been dabbling in vb lately...because I got this web dev job that requires it. My manager recognizes that I had no previous experience with vb, so he offered to help me on it whenever possible.

Now i have all this work plus this online version of an employment application for this company. I managed to right the aspx part of it and get it working and I finally figured out how to format it! Version 1 of the online application is already launched, but not this new one with the formated email. I had to rewrite everything from scracth instead of sticking with the code my manager used on his past projects. Now i need to do something real simple , but I can't do it because I'm not familiar with the vb syntax. I had already asked him for his help, but he's been too busy. I have make a deadline and I don't have time to hit the books on th is stuff.

Basically i need the application to be a little more dynamic by displaying a simple message like "Your Application has been submitted."

The visual basic code of this project:

Imports System.Web.Mail
Partial Class DefaultPage
Inherits System.Web.UI.Page




Sub btnSendFeedback_Click(ByVal sender As Object, ByVal e As EventArgs)

'Create an instance of the MailMessage class
Dim objMM As New MailMessage()

'Set the properties - send the email to the person who filled out the
'feedback form.
objMM.To = " swaters@rapidts.com"
objMM.From = "xxxxxxx"

'If you want to CC this email to someone else, uncomment the line below
'objMM.Cc = "xxxxxx"

'If you want to BCC this email to someone else, uncomment the line below
'objMM.Bcc = "xxxxxxx"

'Send the email in text format
objMM.BodyFormat = MailFormat.Html
'(to send HTML format, change MailFormat.Text to MailFormat.Html)

'Set the priority - options are High, Low, and Normal
objMM.Priority = MailPriority.Normal

'Set the subject
        objMM.Subject = "xxxxx EMPLOYMENT APPLICANT:" + firstname.Text + " " + lastname.Text

'Set the body
        objMM.Body = "<html>" & _
"<body>" & _
"<style type='text/css'>body{font:verdana, arial; font-size:12pt;}b{font-size:10pt;}h1{font-size:13pt; color:#0861A9;}h2{font-size:12pt;}</style>" & _
"<b>Time Submited:</b> " + DateTime.Now & _
"<br />" & vbCrLf & _
"Sentby: " & firstname.Text & "&nbsp;" & middlename.Text & "&nbsp;" & lastname.Text & "." & vbCrLf & vbCrLf & _
"<br />" & vbCrLf & _
"<h1>General Info</h1>" & vbCrLf & _
"<b>First Name:</b> " & firstname.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Last Name:</b> " & lastname.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Middle Name:</b> " & middlename.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Dayphone:</b> " & dayphone.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Eveningphone:</b> " & eveningphone.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>POBox/Address:</b> " & pobox.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>State:</b> " & state.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Zip:</b></b> " & zip.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Expected Hourly Payrate:</b></b>" & payrate.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Reliable Transportation:</b></b>" & DropDownList23.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<h1>Position & Availibility</h1>" & vbCrLf & _
"<b>Position Applying For:</b> " & DropDownList1.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Full-time or Part-time Position:</b> " & DropDownList2.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Date Available:</b> " & availibility.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Desired Hours:</b> " & hoursperweek.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<h1>Education & Training</h1> " & vbCrLf & _
"<b>High School: " & DropDownList3.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<b>College: " & DropDownList4.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Graduate: " & DropDownList5.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<h2>High School Last Attended</h2> " & vbCrLf & _
"<b>High School Graduate:</b> " & DropDownList6.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Name of High School:</b > " & nameofschool1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Start Date:</b> " & startdate1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>End Date:</b> " & enddate1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>City and State:</b> " & cityandstate1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Degree:</b> " & degree1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Subjects Studied, Classes:</b> " & subjects1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<h2>College, University or Technical School</h2>" & vbCrLf & _
"<b>Higher Education Graduate</b> " & DropDownList7.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Name of High School:</b> " & nameofschool2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Start Date:</b> " & startdate2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>End Date:</b> " & enddate2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>City and State:</b> " & cityandstate2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Degree:</b> " & degree2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<h1>References</h1> " & vbCrLf & _
"<h2>Reference 1</h2> " & vbCrLf & _
"<b>Ref 1:</b> " & refname1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Phone:</b> " & refphone1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Known Applicant For:</b> " & refyears1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Mailing Address:</b> " & refmailingaddress1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<h2>Reference 2</h2>" & vbCrLf & _
"<b>Ref 2:</b>" & refname2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Phone:</b>" & refphone2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Known Applicant For:</b> " & refyears2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Mailing Address:</b> " & refmailingaddress2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<h2>Reference 3</h2>" & vbCrLf & _
"<b>Ref 3:</b> " & refname3.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Phone:</b> " & refphone3.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Known Applicant For:</b> " & refyears3.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<h1>Your Employment</h1> " & vbCrLf & _
"<b>Mailing Address:</b> " & refmailingaddress3.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Complied with no illegal drug use:</b> " & DropDownList8.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Reschedule plans for training:</b> " & DropDownList9.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Availible on flexible hours:</b> " & DropDownList10.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Schduled Obligations:</b> " & DropDownList11.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Explaination if stated 'yes' above:</b> " & explainworkinfo.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Availible to start:</b> " & availibility1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Start Sundays @:</b> " & fromdate1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>End Sundays @:</b> " & fromdate2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Start Mondays @:</b> " & fromdate2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>End Mondays @:</b> " & todate2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Start Tuesdays @:</b> " & fromdate3.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>End Tuesdays @:</b>" & todate3.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Start Wednesdays @:</b> " & fromdate4.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>End Wednesdays @:</b> " & todate4.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Start Thursdays @:</b> " & fromdate5.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>End Thursdays @:</b> " & todate5.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Start Fridays @:</b>" & fromdate6.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>End Fridays @:</b> " & todate6.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Start Saturdays @:</b> " & fromdate7.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>End Saturdays @:</b> " & todate7.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Can you submit proof of legal right:</b> " & DropDownList12.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Relationship with current Employee(s) or xxxxx Applicants:</b> " & DropDownList13.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Description of  relationships if stated above:</b> " & explainemployerrelations.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<h1>Employment Record</h1>" & vbCrLf & _
"<b>Previous employee by satellite dealer or sub-dealer:</b> " & DropDownList22.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Satellite or sub-dealer previously worked for:</b> " & formalworkinfo.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>FROM:</b>" & fromdate0.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>TO:</b>" & todate0.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<br />" & vbCrLf & _
"<h2>Recent Employer</h2>" & vbCrLf & _
"<b>Most Recent Employer:</b> " & employername1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Employer's Address:</b> " & employeraddress1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>City, State, Zipcode :</b> " & zipcode1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Initial Position Title:</b> " & initialpositiontitle1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Start Date:</b> " & startdate3.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>End Date:</b> " & enddate3.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Starting Salary:</b> " & startingsalary1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Ending Salary:</b> " & endingsalary1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Average hours worked per week:</b> " & averagehours1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"Last Supervisor's Name:</b> " & supervisorsname1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Final Position Title:</b> " & positiontitle1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Reasons for Leaving:</b> " & reasonsleaving1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>May we contact this employer:</b> " & DropDownList14.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<br />" & vbCrLf & _
"<h2>Second Employer</h2>" & vbCrLf & _
"<b>Second Employer:</b> " & employername2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Employer's Address:</b> " & employeraddress2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>City, State, Zipcode :</b> " & zipcode2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Initial Position Title:</b> " & initialpositiontitle2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Start Date:</b> " & startdate4.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>End Date:</b> " & enddate4.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Starting Salary:</b> " & startingsalary2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Ending Salary:</b> " & endingsalary2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Average hours worked per week:</b> " & averagehours2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Last Supervisor's Name:</b> " & supervisorsname2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Final Position Title:</b> " & positiontitle2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Reasons for Leaving:</b> " & reasonsleaving2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>May we contact this employer:</b> " & DropDownList15.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<br />" & vbCrLf & _
"<h2>Third Employer</h2>" & vbCrLf & _
"<b>Third Employer:</b> " & employername3.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Employer's Address:</b> " & employeraddress3.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>City, State, Zipcode:</b> " & zipcode3.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Initial Position Title:</b> " & initialpositiontitle3.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Start Date:</b> " & startdate5.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>End Date:</b> " & enddate5.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Starting Salary:</b> " & startingsalary3.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Ending Salary:</b> " & endingsalary3.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Average hours worked per week:</b> " & averagehours3.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Last Supervisors Name:</b> " & supervisorsname3.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Final Position Title:</b> " & positiontitle3.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Reasons for Leaving:</b> " & reasonsleaving3.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>May we contact this employer:</b> " & DropDownList16.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<h1>Criminal History</h1>" & vbCrLf & _
"<b>Convicted of felony or misdemeanor:</b> " & DropDownList17.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Explaination of conviction if stated 'yes' above:</b> " & explainconviction.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Date of Conviction:</b> " & dateofconviction.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Date of Arrest:</b> " & dateofarrest.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Offense:</b> " & offense.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Disposition of Case:</b> " & dispositionofcase.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<h1>Other</h1>" & vbCrLf & _
"<b>Number of jobs had in the past year:</b> " & numberofjobs.Text & vbCrLf & _
"<br />" & vbCrLf & _
"Number of jobs had in the past two years:</b>" & numberofjobs1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Circumstances for leaving each job:</b> " & circumstances.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Desired minimum earned per hour:</b> " & hour.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Desired minimum earned per year:</b> " & year.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>If hired, notice needed to be given to their current employer:</b> " & ifhirednotice.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Specialize training, coursework, skills training:</b> " & skillstraining.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Can type:</b> " & DropDownList18.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Word per minute:</b> " & ifwords.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Bi/Multiligual:</b> " & DropDownList19.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Speaks:</b> " & languages.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Speaks:</b> " & languages1.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Speaks:</b> " & languages2.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Referred by:</b> " & DropDownList20.SelectedItem.ToString & vbCrLf & _
"<br />" & vbCrLf & _
"<b>Referred by this employee:</b> " & refemployee.Text & vbCrLf & _
"<br />" & vbCrLf & _
"<b>AAgrees with equal oppertunity policy:</b> " & DropDownList20.SelectedItem.ToString & vbCrLf & _
"</body>" & _
"</html>"
'Specify to use the default Smtp Server
        SmtpMail.SmtpServer = "xxxxxxxxx"
'Now, to send the message, use the Send method of the SmtpMail class
SmtpMail.Send(objMM)

End Sub

End Class

Basically I need to incorporate a simple if statement like:

If Not err Then
            Me.SubmitLabel.Text = "Your application has been sent :)"
            Me.SubmitLabel.ForeColor = Drawing.Color.Green
        Else
            Me.SubmitLabel.Text = "An error occured sending your message, please try the link above."
            Me.SubmitLabel.ForeColor = Drawing.Color.Red
        End If

Can someone point me to a simple tutorial on how to do that or show me how?


Like I said , I'm not familiar with the syntax itself. If need be, I can provide the aspx portion of the project.

Nevermind, it's all cool now.

Instead of waiting for a reply here, I took the time to hit the books.

It was much simpler than I thought:

If IsValid Then
SmtpMail.Send(objMM)
Me.SubmitLabel.Text = "Your application has been sumitted. :)"
Me.SubmitLabel.ForeColor = Drawing.Color.Green
End If


^ used in congruently with asp validation controls.


I was thinking I had to use a subroutine on this one.

This question has already been answered. Start a new discussion instead.