Ok i built my own little form for this. But I am stuck.
I pass the variables to the new little pop up form. But I am missing how to call the form as a function so i can get the result of wich radio button was selected.
I put a comment in where i think a function would be needed to get the return but have never asked for info back from a form before. Only sent it to a new form.
Any guidence?
I did a simple moc up to get it working then will go for the real deal. Form 1
Form 2Code:Public Class Form1 Dim total As Integer = 3 Dim strtxt(5) As String Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' This needs to be a function that then sets the restults to label2.txt Dim NewMDIChild As New Form2(total, strtxt) NewMDIChild.Show() End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim txt1 As String = "1st line" Dim txt2 As String = "2nd line" Dim txt3 As String = "3rd line" Dim txt4 As String = "4th line" Dim txt5 As String = "5th line" strtxt(0) = txt1 strtxt(1) = txt2 strtxt(2) = txt3 strtxt(3) = txt4 strtxt(4) = txt5 End Sub End Class
Code:Public Class Form2 Dim ttl As Integer Dim Tstring(5) As String Public Sub New(ByVal totalvar As Integer, ByVal txtstr() As String) InitializeComponent() ttl = totalvar Tstring = txtstr End Sub Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim radioarray(5) As RadioButton radioarray(0) = RadioButton1 radioarray(1) = RadioButton2 radioarray(2) = RadioButton3 radioarray(3) = RadioButton4 radioarray(4) = RadioButton5 For count As Integer = 0 To 4 radioarray(count).Visible = False Next For count As Integer = 0 To ttl radioarray(count).Text = Tstring(count) radioarray(count).Visible = True Next End Sub End Class




Reply With Quote