vb.net - Dynamic TableLayout Panel -
i want create tablelayout panel dynamically.
i have achieved 1 column size fixed ie 2 row size dynamically adding - how add every row same height?
suppose have
- 2 columns , rows (dynamically)
- 1st column contain radio buttons , second column contain emails
how add dynamically 1 one?
radiobutton1 label1 radiobutton1 label1
like that?
this dynamic table code
dim dynamictablelayout new tablelayoutpanel private sub dynamictable(byval rowcount integer) me.dynamictablelayout.columncount = 2 me.dynamictablelayout.columnstyles.add(new system.windows.forms.columnstyle(system.windows.forms.sizetype.percent, 8.333333!)) me.dynamictablelayout.columnstyles.add(new system.windows.forms.columnstyle(system.windows.forms.sizetype.percent, 91.66666!)) me.dynamictablelayout.location = new system.drawing.point(0, 3) 'me.dynamictablelayout.name = "tablelayoutpanel1" me.dynamictablelayout.rowcount = rowcount integer = 0 dynamictablelayout.rowcount - 1 step 1 me.dynamictablelayout.rowstyles.add(new system.windows.forms.rowstyle(system.windows.forms.sizetype.percent)) me.dynamictablelayout.height = 100 next me.dynamictablelayout.autosize = true me.dynamictablelayout.size = new system.drawing.size(417, 454) me.dynamictablelayout.tabindex = 0 me.dynamictablelayout.autoscroll = true me.dynamictablelayout.anchor = anchorstyles.none me.dynamictablelayout.backcolor = color.violet me.dynamictablelayout.rowstyles.clear() me.dynamictablelayout.columnstyles.clear() me.dynamictablelayout.cellborderstyle = system.windows.forms.tablelayoutpanelcellborderstyle.outsetdouble me.pnlemail.resumelayout(false) pnlemail.controls.add(dynamictablelayout) end sub
this placing control code
dim integer=0 private sub placedynamiccontrol() each email string in arremailslist rb.name = "rb" & email tablelayoutpanel1.controls.add(rb, 0, i) lbl.name = "lbl" & email lbl.text = email lbl.size = new system.drawing.size(500, 15) dynamictablelayout.controls.add(lbl, 1, i) = + 1 next end sub
but unable placing controls , need scrollbar
please me
you can explicitly set column , row of child control within tablelayoutpanel using setcolumn , setrow methods:
protected overrides sub onload(e eventargs) mybase.onload(e) dynamictable.columncount = 2 dynamictable.rowcount = 5 = 0 4 dim label = new label() label.text = i.tostring() dynamictable.setcolumn(label, 0) dynamictable.setrow(label, i) dynamictable.controls.add(label) next end sub
Comments
Post a Comment