Tuesday, 13 August 2013

Concat string variable and integer variable

Concat string variable and integer variable

I have a form with 12 groupbox and each of that groupbox there is 3 radio
buttons. I use for loop to get what radio button is checked and get the
value of radio button. I declare string and integer variables to go
through groupboxes and radiobuttons. My problem is how to concat string
variable and integer variable. sample code :
Dim opt, opt1, opt2, opt3, opt4, opt5, opt6, opt7, opt8, opt9, opt10,
opt11, opt12 As String
Dim grpboxcnt As Integer = 1
Dim rdbtncnt As Integer = 1
Dim xrdbtn As String
For Each grpbx As GroupBox In Me.Controls.OfType(Of GroupBox)()
For Each rdbtn As RadioButton In Me.Controls("GroupBox" &
grpboxcnt).Controls.OfType(Of RadioButton)()
If rdbtn.Checked = True Then
If rdbtn.Text = "Yes" Then
opt1 = 1 'here i want to concat the string(opt) and
integer(rdbtncnt =1)
ElseIf rdbtn.Text = "No" Then
opt1 = 0
ElseIf rdbtn.Text = "NA" Then
opt1 = 2
End If
End If
rdbtncnt += 1
Next
grpboxcnt += 1
Next
sqlcommand.commandType = "UPDATE table1 SET radio1 = @opt1, radio2 = @opt2
, radio2 = @opt3 , etc... WHERE tableID = 1"
thanks in advance!

No comments:

Post a Comment