Converting VB.Net code C#

Converting VB.Net code C#

Post by U2Fp » Thu, 14 Sep 2006 01:17:02


Hello,

I am new to .Net world and I need some help in converting VB.Net code to C#.

Public Overridable Property CaseSensitiveKeySort() As Boolean
Get
Return _caseSensitiveKeySort
End Get
Set(ByVal Value As Boolean)
_caseSensitiveKeySort = Value
End Set
End Property

Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
MyBase.OnLoad(e) ' call the base class method
Dim script As String
string = "<script language=" & Chr(34) & "javascript" & Chr(34) & " type="
& Chr(34) & "text/javascript" & Chr(34) & ">" & vbCrLf
....................................
....................................
....................................
....................................
script &= "</script>"
Me.Page.RegisterClientScriptBlock(functionName, script)
Me.Attributes.Add("onkeypress", "return " + functionName + "(this," +
_caseSensitiveKeySort.ToString().ToLower() + ")")
End Sub

Thanks in advance
SK
 
 
 

Converting VB.Net code C#

Post by Mattias Sj » Thu, 14 Sep 2006 03:49:56


FYI, there are online language conversion tools that can help you with
this. I bet google can help you find one. The code should look
something like this

public virtual bool CaseSenitiveKeySort
{
get [ return _caseSensitiveKeySort; }
set { _caseSensitiveKeySort = value; }
}

protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
string script = "<script language=\"javascript\"" +
"type=\"text/javascript\">\r\n</script>";
this.Page.RegisterClientScriptBlock(functionName, script);
this.Attributes.Add("onkeypress", "return " + functionName +
"(this," + _caseSensitiveKeySort.ToString().ToLower() + ")");
}


Mattias

--
Mattias Sjren [C# MVP] mattias @ mvps.org
http://www.yqcomputer.com/ | http://www.yqcomputer.com/
Please reply only to the newsgroup.

 
 
 

Converting VB.Net code C#

Post by RGF2aWQgQW » Thu, 14 Sep 2006 08:00:02

Our Instant C# VB to C# converter produces:
public virtual bool CaseSensitiveKeySort
{
get
{
return _caseSensitiveKeySort;
}
set
{
_caseSensitiveKeySort = value;
}
}

protected override void OnLoad(System.EventArgs e)
{
base.OnLoad(e); // call the base class method
string script = null;
string = "<script language=" + (char)(34) + "javascript" + (char)(34) + "
type=" + (char)(34) + "text/javascript" + (char)(34) + ">" +
System.Environment.NewLine;

script += "</script>";
this.Page.RegisterClientScriptBlock(functionName, script);
this.Attributes.Add("onkeypress", "return " + functionName + "(this," +
_caseSensitiveKeySort.ToString().ToLower() + ")");

}

--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
C# Code Metrics: Quick metrics for C#