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

Trying to calculate a set placement for dynamic radio buttons?

$
0
0
I have a groupbox that dynamically loads radiobuttons horizontally. The problem that I'm having is that the "Width" property of the radiobutton stays the same regardless of what the "Text" property is. I've set the rdo.AutoSize = True and that still doesn't help. Below is the code that sets this up.

Code:

                Dim iLeft As Integer = 13

                For Each row As DataRow In EH.DataSet.Tables(0).Rows
                    Dim rdo As New RadioButton

                    rdo.Top = 19
                    rdo.Left = iLeft
                    rdo.Text = row("calibrationType")
                    rdo.Tag = row("calibrationType_ID")
                    rdo.Name = "rdo" & row("calibrationType_ID")
                    rdo.Font = New Font(rdo.Font, FontStyle.Regular)
                    rdo.AutoSize = True

                    iLeft += (rdo.Width + 2)

                    rdo.Size = New Point(19, iLeft)

                    grpCalibrationType.Controls.Add(rdo)
                Next

What am I doing wrong?

Thanks,

Viewing all articles
Browse latest Browse all 27404

Trending Articles



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