The following is produced by our Instant C# VB.NET to C# converter (it can
also be produced with our free Demo Edition at
www.instantcsharp.com):
public class test1 : System.Web.UI.Page
{
#region Web Form Designer Generated Code
//This call is required by the Web Form Designer.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
//INSTANT C# NOTE: Converted event handlers:
this.Load += new System.EventHandler(Page_Load);
Button1.Click += new System.EventHandler(Button1_Click);
}
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.Label Label1;
//NOTE: The following placeholder declaration is required by the Web
Form Designer.
//Do not delete or move it.
private object designerPlaceholderDeclaration;
//ORIGINAL LINE: Private Sub Page_Init(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles base.Init
override protected void OnInit(System.EventArgs e)
{
base.OnInit(e);
//CODEGEN: This method call is required by the Web Form
Designer
//Do not modify it using the code editor.
InitializeComponent();
}
#endregion
private bool _refreshState;
private bool _isRefresh;
//INSTANT C# NOTE: This method is an event handler
//ORIGINAL LINE: Private Sub Page_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles base.Load
private void Page_Load(object sender, System.EventArgs e)
{
//Put user code to initialize the page here
this.label1.Text = "Page Refreshed =" +
_isRefresh.ToString();
}
protected override void LoadViewState(object savedState)
{
object[] AllStates = savedState;
base.LoadViewState(AllStates[0]);
_refreshState = bool.Parse(AllStates[1]);
_isRefresh = _refreshState == Session["__ISREFRESH"];
}
protected override object SaveViewState()
{
Session["__ISREFRESH"] = _refreshState;
object[] AllStates = new object[3];
AllStates[0] = base.SaveViewState();
AllStates[1] = ! (_refreshState);
return AllStates;
}
//INSTANT C# NOTE: This method is an event handler
//ORIGINAL LINE: Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
private void Button1_Click(object sender, System.EventArgs e)
{
}
}
As Kevin mentioned, certainly learn C# yourself and verify that the
translation is correct. You certainly don't want to translate thousands of
lines of code manually, but you do need to know whether the converted code is
good or not.
Enjoy,
David Anton
www.tangiblesoftwaresolutions.com
Home of the Instant C# VB.NET to C# converter
and the Instant VB C# to VB.NET converter
"Kylin" wrote:
Public Class test1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Button2 As System.Web.UI.WebControls.Button
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private _refreshState As Boolean
Private _isRefresh As Boolean
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Me.label1.Text = "Page Refreshed =" + _isRefresh.ToString
End Sub
Protected Overrides Sub LoadViewState(ByVal savedState As Object)
Dim AllStates As Object() = savedState
MyBase.LoadViewState(AllStates(0))
_refreshState = Boolean.Parse(AllStates(1))
_isRefresh = _refreshState = Session("__ISREFRESH")
End Sub
Protected Overrides Function SaveViewState() As Object
Session("__ISREFRESH") = _refreshState
Dim AllStates() As Object = New Object(2) {}
AllStates(0) = MyBase.SaveViewState
AllStates(1) = Not (_refreshState)
Return AllStates
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
End Sub
End Class
--
FireCrow Studio
Kylin Garden
ICQ:156134382