Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
C# / VB.NET - aggiungere radiobutton in array volta per volta
Forum - C# / VB.NET - aggiungere radiobutton in array volta per volta

Avatar
Shark (Normal User)
Rookie


Messaggi: 35
Iscritto: 12/06/2014

Segnala al moderatore
Postato alle 21:06
Martedì, 05/08/2014
come posso aggiungere dei radiobutton inizialmente in "Array1" ad "Array2"?

For Each radiobutton in array1
If RadioButton.Checked Then
         RadioButton.Location = New Point (l ,i)
         [E QUI IL CODICE PER AGGIUNGERE IL RADIOBUTTON ALL'ARRAY2]
End If
next

PM Quote
Avatar
dnha (Member)
Pro


Messaggi: 137
Iscritto: 24/07/2014

Segnala al moderatore
Postato alle 23:04
Martedì, 05/08/2014
Ciao, non ho capito in che senso i radiobutton sono in un array :-?
Puoi postare il codice completo?

PM Quote
Avatar
Shark (Normal User)
Rookie


Messaggi: 35
Iscritto: 12/06/2014

Segnala al moderatore
Postato alle 23:32
Martedì, 05/08/2014
Sub Button3Click(sender As Object, e As EventArgs)
            array1 = New RadioButton (6) {radioButton1, radioButton2, radioButton3, radioButton4,                   .                                                                                               radioButton5, radioButton6, radioButton7}
        
              For Each radiobutton In array1
            i= 0
            
            If radioButton1.Checked
                i = 300
                l = 250
            ElseIf radioButton2.Checked
                i = 285
                l = 255
            ElseIf radioButton3.Checked
                i = 270
                l = 260
            ElseIf radioButton4.Checked
                i = 255
                l = 265
            ElseIf radioButton5.Checked
                i = 240
                l = 270
            ElseIf radioButton6.Checked
                i = 225
                l = 275
            ElseIf radioButton7.Checked
                i = 210
                l = 280
        End If
    
            
                If RadioButton.Checked Then
                    RadioButton.Location = New Point (l ,i)
                                        [E QUI IL CODICE PER AGGIUNGERE IL RADIOBUTTON ALL'ARRAY2]
                End If
            Next
    End Sub


questa è la sub del bottone, praticamente ho bisogno che mi aggiunga i radiobutton che vengono spostati in un altro array,il due appunto.....

PM Quote
Avatar
dnha (Member)
Pro


Messaggi: 137
Iscritto: 24/07/2014

Segnala al moderatore
Postato alle 14:27
Mercoledì, 06/08/2014
Prova con (VB.NET) :k: :
Codice sorgente - presumibilmente VB.NET

  1. Dim array2
  2. If RadioButton.Checked Then
  3.    RadioButton.Location = New Point (l ,i)
  4.  
  5.    ReDim Preserve array2(array2.lenght)
  6.    array2(array2.lenght) = radiobutton
  7. End If



PM Quote