Convert VB code to C# code

G

Guest

I need help converting the VB code

Private Sub Button1_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
Dim cntrlTester As Control
Dim chkTester As CheckBox
Dim sb As New System.Text.StringBuilder
For Each cntrlTester In _
Page.Controls(1).Controls
If TypeOf cntrlTester Is _
System.Web.UI.WebControls.CheckBox Then
chkTester = cntrlTester
sb.Append(chkTester.ID & _
" : " & chkTester.Checked.ToString & _
"<br>")
End If
Next
Label1.Text = sb.ToString
End Su
<form id="Form1" method="post" runat="server"><p><asp:CheckBox id="CheckBox1" runat="server"
text="checkbox1"></asp:checkbox></p><p><asp:CheckBox id="CheckBox2" runat="server"
text="checkbox2"></asp:checkbox></p><p><asp:CheckBox id="CheckBox3" runat="server"
text="checkbox3"></asp:checkbox></p><p><asp:Label id="Label1" runat="server"></asp:label></p><p><asp:Button id="Button1" runat="server" text="button"></asp:button></p></form

TO C# code for Visual Studio .NE

Thanks

bebo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top