Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 5th, 2007, 06:08 AM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default help, converting vb.net few lines to C#

 Could anybody please, help in converting the following few lines to C#???

  Public Sub Send_Email2(ByVal claimID As Integer, ByVal ApartmentID As Integer, ByVal strComplaintTitle As String, ByVal strFullName As String, ByVal strPriority As String, ByVal strProblemDetails As String)

            Dim UNMtxt As String = "nesrine72@hotmail.com"

            Try

                Dim varMailbody As String
                varMailbody = "<b>Dear Admin,</b><br><br>"
                varMailbody = varMailbody & "You got a new ticket."
                varMailbody = varMailbody & "<b>Ticket Number: </b>" & claimID & "<b> Customer Name: </b>" & strFullName & "<br>"
                varMailbody = varMailbody & "<br><b>Problem Title: </b>" & strComplaintTitle & "<b> Priority: " & strPriority & "</b><br>"
                varMailbody = varMailbody & "<br><b>Problem Details: </b>" & strProblemDetails & "<br><br>Please check and reply.<br><br>Thank you<br>albab.com<br>"



                Dim ToAddress As String = UNMtxt

                Dim fromAddress As String = "nesrine1972@yahoo.com"

                '(1) Create the MailMessage instance
                Dim mm As New MailMessage(fromAddress, ToAddress)

                '(1.2) set the e-mail Priority
                mm.Priority = CInt(DropDownList1.SelectedValue)

                '(2) Assign the MailMessage's properties
                mm.Subject = "New Ticket - albab.com"
                mm.Body = varMailbody
                mm.IsBodyHtml = True
                '(3) Create the SmtpClient object
                Dim smtp As New SmtpClient
                'smtp.Host = "mail.albab.com"
                smtp.Host = "LOCALHOST"
                smtp.Port = 25

                smtp.Credentials = New NetworkCredential("nesrine1972@yahoo.com", "Sys!234")

                '(4) Send the MailMessage (will use the Web.config settings)
                smtp.Send(mm)

               Response.redirect("~/OrderCompleted.aspx");

                findlastTicketno()



            Catch ex As Exception
                Errlbl.Text = "Sorry! Your ticket can not be submitted at the moment!"
                Errlbl.Text = Errlbl.Text & " " & ex.Message

            End Try

        End Sub

Reply With Quote
  #2 (permalink)  
Old March 5th, 2007, 07:28 PM
Authorized User
 
Join Date: Feb 2004
Location: , , .
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The following was obtained with Instant C#:

        public void Send_Email2(int claimID, int ApartmentID, string strComplaintTitle, string strFullName, string strPriority, string strProblemDetails)
        {

            string UNMtxt = "nesrine72@hotmail.com";

            try
            {

                string varMailbody = null;
                varMailbody = "<b>Dear Admin,</b><br><br>";
                varMailbody = varMailbody + "You got a new ticket.";
                varMailbody = varMailbody + "<b>Ticket Number: </b>" + claimID + "<b> Customer Name: </b>" + strFullName + "<br>";
                varMailbody = varMailbody + "<br><b>Problem Title: </b>" + strComplaintTitle + "<b> Priority: " + strPriority + "</b><br>";
                varMailbody = varMailbody + "<br><b>Problem Details: </b>" + strProblemDetails + "<br><br>Please check and reply.<br><br>Thank you<br>albab.com<br>";



                string ToAddress = UNMtxt;

                string fromAddress = "nesrine1972@yahoo.com";

                //(1) Create the MailMessage instance
                MailMessage mm = new MailMessage(fromAddress, ToAddress);

                //(1.2) set the e-mail Priority
                mm.Priority = System.Convert.ToInt32(DropDownList1.SelectedValue );

                //(2) Assign the MailMessage's properties
                mm.Subject = "New Ticket - albab.com";
                mm.Body = varMailbody;
                mm.IsBodyHtml = true;
                //(3) Create the SmtpClient object
                SmtpClient smtp = new SmtpClient();
                //smtp.Host = "mail.albab.com"
                smtp.Host = "LOCALHOST";
                smtp.Port = 25;

                smtp.Credentials = new NetworkCredential("nesrine1972@yahoo.com", "Sys!234");

                //(4) Send the MailMessage (will use the Web.config settings)
                smtp.Send(mm);

               Response.redirect("~/OrderCompleted.aspx");

                findlastTicketno();



            }
            catch (Exception ex)
            {
                Errlbl.Text = "Sorry! Your ticket can not be submitted at the moment!";
                Errlbl.Text = Errlbl.Text + " " + ex.Message;

            }

        }


Reply With Quote
  #3 (permalink)  
Old March 6th, 2007, 02:52 AM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much, that was a great help, you saved me.

Please note that void is underlined because of
"Invalid token void in calss, struct, order interface member declaration "
so what am i supposed to do??

Reply With Quote
  #4 (permalink)  
Old March 6th, 2007, 10:43 AM
Authorized User
 
Join Date: Feb 2004
Location: , , .
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The method must be within a class or struct.


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
help, converting vb.net few lines to C# nesrine ASP.NET 2.0 Professional 1 March 5th, 2007 07:10 AM
Datagrid scroll count (Lines) VB.NET 2003 peterasimpson VB.NET 4 November 24th, 2005 05:34 PM
Datagrid scroll count (Lines) VB.NET 2003 peterasimpson VB How-To 1 November 24th, 2005 12:33 AM
converting DTS package from VB 6 to VB .NET petroleo Pro VB Databases 0 August 18th, 2003 05:01 PM



All times are GMT -4. The time now is 10:25 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.