Advanced VB.Net

Moderators: None (Apply to moderate this forum)
Number of threads: 256
Number of posts: 390

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Programatically creating and fetching controls in TablelayoutPanel in Posted by elizas on 27 Jan 2010 at 5:50 AM
hi,
I have something to share with all.
Tablelayoutpanel can arrange the controls in the cells by defining the column and row number. We can add controls by defining the column and row Number.

Add a TableLayoutPanel control in the form and name it as "TablelayoutPnl".

Dim IDLbl As New Label
IDLbl.Name = "ID"
IDLbl.Size = New System.Drawing.Size(10, 17)
IDLbl.Text = "Test"
Dim IDpos As New TableLayoutPanelCellPosition(0, 0)
TablelayoutPnl.SetCellPosition(IDLbl, IDpos)
TablelayoutPnl.Controls.Add(IDLbl)

Dim NameTxt As New TextBox
NameTxt.Size = New System.Drawing.Size(100, 17)
NameTxt.Text = "Test Data"
Dim NamePos As New TableLayoutPanelCellPosition(1, 0)
TablelayoutPnl.SetCellPosition(NameTxt, NamePos)
TablelayoutPnl.Controls.Add(NameTxt)

Here one label and text box will be created in the first row in the first and second cell respectively.TableLayoutPanelCellPosition takes two parameters column and row. we can increase the row number in a for...loop if we want to create more number of rows

Thanks
Eliza




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.