nesrine

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


Re: Visual Basic General Could anybody please, help in converting the following few lines to C#?

SJWhiteley

You are asking in a VB forum how to write in c#

Perhaps try a C# forum, or search for an online translator, such as http://www.carlosag.net/Tools/CodeTranslator/Default.aspx






Re: Visual Basic General Could anybody please, help in converting the following few lines to C#?

David Anton

It's not that unreasonable (C# people shouldn't be expected to understand VB, should they ).

The C# equivalent (via Instant C#) is:

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;

}

}

David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter, VB to C++ converter
Instant Python: C# to Python converter, VB to Python converter






Re: Visual Basic General Could anybody please, help in converting the following few lines to C#?

SJWhiteley

It's not that unreasonable (C# people shouldn't be expected to understand VB, should they ).

Perhaps not, but I've found that C# programmers tend to be a bit more, um, 'advanced' than VB programmers, on the whole...






Re: Visual Basic General Could anybody please, help in converting the following few lines to C#?

David Anton

Uh oh - I'm not touching that one...






Re: Visual Basic General Could anybody please, help in converting the following few lines to C#?

nesrine

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