Click here to Skip to main content
15,892,059 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: VB.NET Date Functions Calculations Pin
Steven J Jowett29-Mar-10 22:52
Steven J Jowett29-Mar-10 22:52 
GeneralRe: VB.NET Date Functions Calculations Pin
Member 442053429-Mar-10 23:08
Member 442053429-Mar-10 23:08 
GeneralRe: VB.NET Date Functions Calculations Pin
Member 442053429-Mar-10 23:23
Member 442053429-Mar-10 23:23 
GeneralRe: VB.NET Date Functions Calculations Pin
Steven J Jowett29-Mar-10 23:42
Steven J Jowett29-Mar-10 23:42 
QuestionResize external application Pin
csanmba29-Mar-10 10:55
csanmba29-Mar-10 10:55 
AnswerRe: Resize external application Pin
Tarakeshwar Reddy29-Mar-10 12:15
professionalTarakeshwar Reddy29-Mar-10 12:15 
GeneralRe: Resize external application Pin
csanmba30-Mar-10 1:43
csanmba30-Mar-10 1:43 
QuestionOK Going Mad...VB.Net Mail Pin
Dalek Dave29-Mar-10 9:59
professionalDalek Dave29-Mar-10 9:59 
I have a webpage with text boxes, Radio Buttons and a Button.

User is to fill in the boxes and select a radio button, fill in the message box and then press send.

I want to send to an email address dependant on the radio button choice, and I cannot get it to work.

Here is the code

Public Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim strName As String
        Dim strAddress As String
        Dim strMessage As String
        Dim strType As String
        Dim strSendTo As String
        Dim strSendFrom As String = "WebAddress"
        Dim CompleteMessage As String

        strName = ContactName.Text()
        strAddress = ContactAddress.Text()
        strMessage = TextBox1.Text()
        strType = RadioButtonList1.SelectedValue

        Select Case strType
            Case "sales"
                strSendTo = "silverfox@live.co.uk"
            Case "contractors"
                strSendTo = "colin@fosbern.co.uk"
            Case "general"
                strSendTo = "pat@fosbern.co.uk"
            Case Else
                strSendTo = "enquiries@fosbern.co.uk"
        End Select
        CompleteMessage = "Message From Website " & vbNewLine & strSendFrom & vbNewLine & strSendTo _
        & vbNewLine & vbNewLine & strType & vbNewLine & strMessage


        Sendmsg(, strSendTo, CompleteMessage)




    End Sub



Sendmsg is called, here, so far is what I have,
Public Sub Sendmsg(Optional ByVal msgfrom As String = "", Optional ByVal msgto As String = "", _
                       Optional ByVal msgmessage As String = "")
        Dim SendMessage As New MailMessage


        Try
            With SendMessage
                .To (msgto)
                .From (msgFrom)
                .Body (msgmessage)
                .send
            End With
        Catch ex As Exception

        End Try
    End Sub


But it is starting to fall apart.

Arrghhh! I have been at this for ages.
I have the following imports

Imports System
Imports System.Net
Imports System.Net.Mail
Imports System.Net.Mail.MailMessage


It is having problems with assigning values to the to and from variables.
------------------------------------

I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave

AnswerRe: OK Going Mad...VB.Net Mail Pin
nlarson1129-Mar-10 10:18
nlarson1129-Mar-10 10:18 
GeneralRe: OK Going Mad...VB.Net Mail Pin
Dalek Dave29-Mar-10 21:27
professionalDalek Dave29-Mar-10 21:27 
QuestionNew line to be added to a mail message [modified] Don't Worry, got it! Pin
Dalek Dave29-Mar-10 8:56
professionalDalek Dave29-Mar-10 8:56 
AnswerRe: New line to be added to a mail message [modified] Don't Worry, got it! Pin
nlarson1129-Mar-10 10:23
nlarson1129-Mar-10 10:23 
QuestionStatic Variables for Grade Counting Program [modified] - SOLVED Pin
Adam Wike29-Mar-10 4:39
Adam Wike29-Mar-10 4:39 
AnswerRe: Static Variables for Grade Counting Program Pin
Estys29-Mar-10 5:09
Estys29-Mar-10 5:09 
AnswerRe: Static Variables for Grade Counting Program Pin
Steven J Jowett29-Mar-10 6:12
Steven J Jowett29-Mar-10 6:12 
GeneralRe: Static Variables for Grade Counting Program Pin
Adam Wike30-Mar-10 4:17
Adam Wike30-Mar-10 4:17 
GeneralRe: Static Variables for Grade Counting Program Pin
Steven J Jowett30-Mar-10 4:35
Steven J Jowett30-Mar-10 4:35 
GeneralRe: Static Variables for Grade Counting Program Pin
Adam Wike30-Mar-10 4:51
Adam Wike30-Mar-10 4:51 
GeneralRe: Static Variables for Grade Counting Program Pin
Steven J Jowett30-Mar-10 5:56
Steven J Jowett30-Mar-10 5:56 
Questionscript to copy web page contents into text file Pin
220828-Mar-10 18:41
220828-Mar-10 18:41 
AnswerRe: script to copy web page contents into text file Pin
DaveAuld28-Mar-10 23:07
professionalDaveAuld28-Mar-10 23:07 
QuestionTwo checkbox in single column of datagridview Pin
C#Coudou28-Mar-10 13:44
C#Coudou28-Mar-10 13:44 
AnswerRe: Two checkbox in single column of datagridview Pin
Dave Kreskowiak28-Mar-10 14:22
mveDave Kreskowiak28-Mar-10 14:22 
Questioninstalling application [modified] .... resolved Pin
Daniel Engelkes28-Mar-10 12:55
Daniel Engelkes28-Mar-10 12:55 
AnswerRe: installing application Pin
Dalek Dave28-Mar-10 13:09
professionalDalek Dave28-Mar-10 13:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.