Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 Grabbing a control name

$
0
0
Is there an an easier way to get the checked control name? I have 200 of these to code and it seems like a lot of redundant code.

Code:

Private Sub SelfMutRDB0_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles SelfMutRDB0.CheckedChanged, SelfMutRDB1.CheckedChanged, SelfMutRDB2.CheckedChanged, SelfMutRDB3.CheckedChanged
        mycontr = ""

        If SelfMutRDB0.Checked Then
            mycontr = SelfMutRDB0.Name
        Else
            If SelfMutRDB1.Checked Then
                mycontr = SelfMutRDB1.Name
            Else
                If SelfMutRDB2.Checked Then
                    mycontr = SelfMutRDB2.Name
                Else
                    mycontr = SelfMutRDB3.Name
                End If
            End If
        End If
        'MessageBox.Show(mycontr)
        CheckValue(mycontr)
    End Sub


Viewing all articles
Browse latest Browse all 27554

Trending Articles



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