 |
|
|
|
Mimicking a Data Repeater Control in WinForms
|
|
|
 |
|
Location: Blogs Andy's Blog |
|
| Posted by: host |
1/4/2006 8:03 PM |
VB6 had the cool Data Repeater which allowed you to create an ActiveX control and databind it so that it would show an instance of the user control for each row in your record set.
This cool control is missing from .NET, but it's pretty easy to mimick this functionality. Just create a Panel, set its AutoScroll property to True, and use the Controls collection to dynamically add instances of the user control. You will need to also track the Y Offset of each control you add to push down each instance.
Dim m_YOffSet As Integer = 0
Public Sub AddAddress(ByVal AddressId As Integer) Dim ucAddress1 As New ucAddress ucAddress1.Address = "123 University Lane" Panel1.Controls.Add(ucAddress1) ucAddress1.Visible = True ucAddress1.Top = m_YOffSet m_YOffSet += ucAddress1.Height End Sub |
|
| Permalink |
Trackback |
|
|
 |
|
 |
|
|