Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15567

Get RadioButton Selection from another form

$
0
0
Hi All.. I have form1 as my main form, I have form2 as an alternate form that includes RadioButtons. To save my life, I cannot pass the radiobutton text to my Form1. This is how I have it set right now after many trials of different things. In Form1 the variable is always blank?

Form1: Click button on Form1 to open/show Form2 RadioButtons to make selection

Code:

Public Class Form1
    Public rButtonSelect

Public Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click

  rButtonSelect = Form2.rButton

  Msgbox(rButtonSelect)

End Sub

Form2:

Code:

Public Class Form2
    Public Shared rButton As RadioButton

Public Sub btnSelect_Click(sender As Object, e As EventArgs) Handles btnSelect.Click

    rButton = Panel1.Controls.OfType(Of RadioButton).FirstOrDefault(Function(r) r.Checked = True)
    Me.Dispose()
   
End Sub


Viewing all articles
Browse latest Browse all 15567

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>