Click here to Skip to main content
15,921,646 members
Home / Discussions / Windows Forms
   

Windows Forms

 
GeneralRe: Pass incoming data from Child to parent Form Pin
Pete O'Hanlon16-Sep-10 6:45
mvePete O'Hanlon16-Sep-10 6:45 
QuestionPrint on Thermal Printing Pin
All Time Programming3-Sep-10 3:32
All Time Programming3-Sep-10 3:32 
AnswerRe: Print on Thermal Printing Pin
Dave Kreskowiak3-Sep-10 6:21
mveDave Kreskowiak3-Sep-10 6:21 
GeneralRe: Print on Thermal Printing Pin
All Time Programming3-Sep-10 8:25
All Time Programming3-Sep-10 8:25 
GeneralRe: Print on Thermal Printing Pin
Dave Kreskowiak3-Sep-10 11:12
mveDave Kreskowiak3-Sep-10 11:12 
GeneralRe: Print on Thermal Printing Pin
Dave Kreskowiak3-Sep-10 13:41
mveDave Kreskowiak3-Sep-10 13:41 
GeneralRe: Print on Thermal Printing Pin
Goutam Patra4-Sep-10 1:51
professionalGoutam Patra4-Sep-10 1:51 
QuestionProblem Sending an Email from Desktop App Pin
All Time Programming2-Sep-10 22:31
All Time Programming2-Sep-10 22:31 
Hi,

In my desktop app developed in VB.NET, I want to send an email.
Private Sub CreateMessage()
    Dim from As New MailAddress(fromTxt.Text.Trim, nameTxt.Text.Trim)
    Dim toAdd As New MailAddress(toTxt.Text, totitle)
    Dim msg As New MailMessage(from, toAdd)
    msg.Subject = subjectTxt.Text.Trim
    msg.Body = messageTxt.Text.Trim
    Dim cc1 As New MailAddress(cc1.Text)
    Dim cc2 As New MailAddress(cc2.Text)
    msg.CC.Add(cc1)
    msg.CC.Add(cc2)

    Dim client As New SmtpClient()

    Try
        client.Send(msg)
        ToolStripStatusLabel1.Text = "Message Sent Successfully"
    Catch ex As Exception
        ToolStripStatusLabel1.Text = "Error Sending Mail"
        MessageBox.Show("Error sending mail : " & ex.ToString, "ERROR ::  Try Again", MessageBoxButtons.OK, MessageBoxIcon.Error)
    Finally
        cc1 = Nothing
        cc2 = Nothing
        from = Nothing
        toAdd = Nothing
        msg = Nothing
        client = Nothing
    End Try
    Return
End Sub


Above is the code I use to send email. I have imported System.Net.Mail & set MailMessage object properly also created SmtpClient. But I don't know what and how to set the Smtp host. I mean, the app will be on differnet PC's & all will be using different means of Internet access. Then how can I know and set the host before sending message. I tried adding "localhost" but that didn't worked. What to do and how to achieve the goal ?
This should be possible and in a simpler manner - when I can do the same in my Java apps then why not in .NET apps. Searched a lot on net also, but every example showed "<your server="" name="">", but how can I know the server name of each PC ???

Any help guidance is highly appreciated.

Thanks & Regards,


AnswerRe: Problem Sending an Email from Desktop App Pin
DaveAuld2-Sep-10 22:54
professionalDaveAuld2-Sep-10 22:54 
GeneralRe: Problem Sending an Email from Desktop App Pin
All Time Programming2-Sep-10 23:11
All Time Programming2-Sep-10 23:11 
GeneralRe: Problem Sending an Email from Desktop App Pin
DaveAuld3-Sep-10 0:34
professionalDaveAuld3-Sep-10 0:34 
GeneralRe: Problem Sending an Email from Desktop App Pin
All Time Programming3-Sep-10 0:32
All Time Programming3-Sep-10 0:32 
GeneralRe: Problem Sending an Email from Desktop App Pin
DaveAuld3-Sep-10 0:34
professionalDaveAuld3-Sep-10 0:34 
QuestionHow to change bool flag status on the main windows mobile form by pressing button on the other windows mobile form Pin
acont1-Sep-10 22:27
acont1-Sep-10 22:27 
AnswerRe: How to change bool flag status on the main windows mobile form by pressing button on the other windows mobile form Pin
Eddy Vluggen2-Sep-10 9:12
professionalEddy Vluggen2-Sep-10 9:12 
Questioni am asking for answers and not lectures from you guys Pin
imak31-Aug-10 7:21
imak31-Aug-10 7:21 
AnswerAlmost a repost - please ignore Pin
dan!sh 31-Aug-10 8:21
professional dan!sh 31-Aug-10 8:21 
GeneralRe: Its not a repost but a bit more specific questoin let me explain Pin
Richard MacCutchan31-Aug-10 12:00
mveRichard MacCutchan31-Aug-10 12:00 
GeneralRe: Its not a repost but a bit more specific questoin let me explain Pin
imak31-Aug-10 20:30
imak31-Aug-10 20:30 
AnswerRe: i am asking for answers and not lectures from you guys PinPopular
Tom Deketelaere31-Aug-10 22:06
professionalTom Deketelaere31-Aug-10 22:06 
AnswerRe: Read winform control properties via reflection Pin
dan!sh 31-Aug-10 8:20
professional dan!sh 31-Aug-10 8:20 
QuestionSOLVED - Secure the Software [modified] Pin
All Time Programming31-Aug-10 0:05
All Time Programming31-Aug-10 0:05 
AnswerRe: Secure the Software Pin
dan!sh 31-Aug-10 1:01
professional dan!sh 31-Aug-10 1:01 
GeneralRe: Secure the Software Pin
All Time Programming31-Aug-10 3:27
All Time Programming31-Aug-10 3:27 
GeneralRe: Secure the Software Pin
dan!sh 31-Aug-10 5:13
professional dan!sh 31-Aug-10 5:13 

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.