Mi sono impallato nel codice precedente.codice:Public Function getValueRadioSelected(control As Control, GroupName As String) As String Dim result As String = "" Dim trovato As Boolean = False For Each c As Control In control.Controls If TypeOf c Is RadioButton Then Dim rb As RadioButton = DirectCast(c, RadioButton) Dim nome As String = rb.GroupName If nome = GroupName Then If rb.Checked Then result = rb.Attributes("value") trovato = True 'Return result Exit For End If End If End If If Not trovato Then getValueRadioSelected(c, GroupName) Next Return result End Function
Partendo da un controllo contenitore, debbo trovare il controllo che:
è di tipo RadioButton
ha una data proprietà GroupName
ha la proprietà checked a true
Andando col debug trovo quello che cerco. La variabile result contiene il dato.
Purtroppo continua la ricorsione e perde il suo valore![]()
Mi dareste una mano a venirne a capo?
![]()

Rispondi quotando