radhakrishan
asked on
VB.NET to C#
Hello Experts,
I am new to C# could anyone pls tell me how to convert the following function from VB to C#
Private Function Msgbox(ByVal strMessage As String)
Dim strScript As String = "<script language=JavaScript>"
strScript += "alert(""" & strMessage & """);"
strScript += "</script>"
If (Not Page.IsStartupScriptRegist ered("clie ntScript") ) Then
Page.RegisterStartupScript ("clientSc ript", strScript)
End If
End Function
Also:
Dim dt As DateTime
Dim dt1 As DateTime
dt = New DateTime(sy, sm, sd, sh, smm, 0)
dt1 = New DateTime(ey, em, ed, eh, emm, 0)
Any help appreciated.
I am new to C# could anyone pls tell me how to convert the following function from VB to C#
Private Function Msgbox(ByVal strMessage As String)
Dim strScript As String = "<script language=JavaScript>"
strScript += "alert(""" & strMessage & """);"
strScript += "</script>"
If (Not Page.IsStartupScriptRegist
Page.RegisterStartupScript
End If
End Function
Also:
Dim dt As DateTime
Dim dt1 As DateTime
dt = New DateTime(sy, sm, sd, sh, smm, 0)
dt1 = New DateTime(ey, em, ed, eh, emm, 0)
Any help appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Second part:
DateTime dt = new DateTime(sy, sm, sd, sh, smm, 0);
DateTime dt1 = new DateTime(ey, em, ed, eh, emm, 0);
DateTime dt = new DateTime(sy, sm, sd, sh, smm, 0);
DateTime dt1 = new DateTime(ey, em, ed, eh, emm, 0);
sorry carl, posted on same minute!
ASKER
Hi Guys,
Thanks for the reply.
In the 2nd Part:
DateTime dt = new DateTime(sy, sm, sd, sh, smm, 0);
DateTime dt1 = new DateTime(ey, em, ed, eh, emm, 0);
I get an error on each argument cannot convert string to int.
Should I be writing somthing like int.Parse(sy)
Thanks for the reply.
In the 2nd Part:
DateTime dt = new DateTime(sy, sm, sd, sh, smm, 0);
DateTime dt1 = new DateTime(ey, em, ed, eh, emm, 0);
I get an error on each argument cannot convert string to int.
Should I be writing somthing like int.Parse(sy)
If your variables are strings containing ints then yes.
ASKER
Yeah,
Thanks for the reply.
Thanks for the reply.
Thanks for the points, although I think a Split may have been more appropriate since Zephyr and myself posted the same answer at the same time.
Post a request in Community Support if you want to change the point split.
Post a request in Community Support if you want to change the point split.
{
string strScript = "<script language=JavaScript>";
strScript += "alert(\"" + strMessage + "\");";
strScript += "</script>";
if (!Page.IsStartupScriptRegi
{
Page.RegisterStartupScript
}
}
DateTime dt = new DateTime(sy, sm, sd, sh, smm, 0);
DateTime dt1 = new DateTime(ey, em, ed, eh, emm, 0);