Question Editing a contact form

TommyEvans

Active member
Joined
Feb 19, 2010
Messages
39
Programming Experience
Beginner
Alright. My current contact form, will only let me add the from email in my code. I need a user to be able to enter that themselves, AND for it not to half to be an email. When the email comes in to my inbox, to just say their "username".

Here is what my contact form looks like right now:

2ia4uix.gif



Here is what it should look like. My code is not appropriate for it to do that. What changes do I need to make?

zja3qr.gif


Here is my code:


VB.NET:
Imports System.Net.Mail

Public Class SendAnswer

    Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
        Dim smtpServer As New SmtpClient()
        Dim mail As New MailMessage()
        ProgressBar1.Value = 25
        smtpServer.Credentials = New Net.NetworkCredential("email", "password") 'Gmail
        smtpServer.Port = 587
        smtpServer.Host = "smtp.live.com"
        ProgressBar1.Value = 50
        smtpServer.EnableSsl = True
        mail = New MailMessage()
        mail.From = New MailAddress("this_is_the_from_statment")
        ProgressBar1.Value = 75
        mail.To.Add("same_email_as_above") 'Same As Above
        mail.Subject = txtEvent.Text
        mail.Body = txtAnswer.Text
        smtpServer.Send(mail)
        ProgressBar1.Value = 100
        MsgBox("Your answer has been sent!")
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Close()

    End Sub
End Class
 
Back
Top