By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,866 Members | 1,704 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,866 IT Pros & Developers. It's quick & easy.

converting VB codes to C#

P: n/a
Hi, Could someone please et me know how I can convert the below codes from
Visual Basic to C# using Visual studio. When each button clicked they create
list box and Radio Button. I want to convert those codes into C# doing same
action. The codes are:
Private Sub bAddListbox_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles bAddListbox.Click
Dim lb As New ListBox
lb.Height = 75
lb.Width = 70
lb.Items.Add("listbox")
tlp.Controls.Add(lb)
End Sub

Private Sub bRadiobutton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles bRadiobutton.Click
Dim iNum As Int64
iNum = InputBox("Enter number of options", "Entry", 4)
Dim rbflp As New FlowLayoutPanel
rbflp.AutoSize = True
rbflp.AutoSizeMode = Windows.Forms.AutoSizeMode.GrowAndShrink
rbflp.FlowDirection = FlowDirection.LeftToRight
For i As Int16 = 1 To iNum
Dim rbl As New RadioButton
rbl.Text = "option " + CStr(i)
rbflp.Controls.Add(rbl)
Next
tlp.Controls.Add(rbflp)

End Sub
--
Nejadian
Feb 5 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Visual Studio doesn't do language conversions.

There are many 3rd party tools/utilities that will.

http://www.google.com/search?q=vb.ne...x=&startPage=1

-Scott

"Tammy Nejadian" <Ta***********@discussions.microsoft.comwrote in message
news:54**********************************@microsof t.com...
Hi, Could someone please et me know how I can convert the below codes from
Visual Basic to C# using Visual studio. When each button clicked they
create
list box and Radio Button. I want to convert those codes into C# doing
same
action. The codes are:
Private Sub bAddListbox_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles bAddListbox.Click
Dim lb As New ListBox
lb.Height = 75
lb.Width = 70
lb.Items.Add("listbox")
tlp.Controls.Add(lb)
End Sub

Private Sub bRadiobutton_Click(ByVal sender As System.Object, ByVal e
As
System.EventArgs) Handles bRadiobutton.Click
Dim iNum As Int64
iNum = InputBox("Enter number of options", "Entry", 4)
Dim rbflp As New FlowLayoutPanel
rbflp.AutoSize = True
rbflp.AutoSizeMode = Windows.Forms.AutoSizeMode.GrowAndShrink
rbflp.FlowDirection = FlowDirection.LeftToRight
For i As Int16 = 1 To iNum
Dim rbl As New RadioButton
rbl.Text = "option " + CStr(i)
rbflp.Controls.Add(rbl)
Next
tlp.Controls.Add(rbflp)

End Sub
--
Nejadian

Feb 5 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.