0

Hi All,

How do i get user choice Radio button text from multiple radio button, When i save as word document.
Below code is what i did:

"Food :" & ComboBox1.Text & ", Quantity :" & txtCountFood & vbNewLine &

But instead of using ComboBox (as above code) i want to Use RadioButton1, RadioButton2, RadioButton3 :

"Food :" If RadioButton1.Checked = True Then
    RadioButton1.Checked = "Tomato, Quantity :" & txtCountFood & vbNewLine 
    ElseIf RadioButton2.Checked = True Then
    RadioButton1.Checked = "Tomato, Quantity :" & txtCountFood & vbNewLine
    ElseIf RadioButton3.Checked = True Then
    RadioButton1.Checked = "Tomato, Quantity :" & txtCountFood & vbNewLine
    EndIf

Nothing, came out of it except : Food :

Thank You.

Edited by missy_mi

3
Contributors
5
Replies
60
Views
3 Years
Discussion Span
Last Post by missy_mi
Featured Replies
  • For i = 0 To 2 Dim RadioButton As RadioButton = CType(Me.Controls("RadioButton" & i + 1), RadioButton) If RadioButton.Checked = True Then MsgBox("Food :" & RadioButton.Text & ", Quantity :" & txtCountFood) 'msgbox is example End If Next Read More

  • Try This: Dim orderString as String If RadioButton1.Checked = True Then orderString = "Food : " & RadioButton1.Text & ", Quantity :" & txtCountFood & vbNewLine ElseIf RadioButton2.Checked = True Then orderString = "Food : " & RadioButton2.Text & ", Quantity :" & txtCountFood & vbNewLine ElseIf RadioButton3.Checked = True … Read More

2
       For i = 0 To 2
            Dim RadioButton As RadioButton = CType(Me.Controls("RadioButton" & i + 1), RadioButton)
            If RadioButton.Checked = True Then
                MsgBox("Food :" & RadioButton.Text & ", Quantity :" & txtCountFood)  'msgbox is example
            End If
        Next
1

Try This:

Dim orderString as String 

If RadioButton1.Checked = True Then
       orderString = "Food : " & RadioButton1.Text & ", Quantity :" & txtCountFood & vbNewLine
ElseIf RadioButton2.Checked = True Then
       orderString = "Food : " & RadioButton2.Text & ", Quantity :" & txtCountFood & vbNewLine
ElseIf RadioButton3.Checked = True Then
     orderString = "Food : " & RadioButton3.Text & ", Quantity :" & txtCountFood & vbNewLine
EndIf

Then get orderString variable.

0

Thanks you guys for your help, I tried :

        Dim rButton as string

        if  RadioButton1.Checked = True Then
        rButton = "Tomato , Quantity : & txtCountOrder.Text &", Price : " & lblResult1.Text & vbNewLine
        ElseIf RadioButton2.Checked = True Then
        rButton = "Potato , Quantity :" & txtCountOrder.Text &", Price : " & lblResult1.Text & vbNewLine
        .....
        .....
        ......
        EndIf

        "Food : " & rButton 

Edited by missy_mi

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.