Results 1 to 2 of 2

Thread: Span Rows/colums in TableLayout in code.

  1. #1

    Thread Starter
    New Member DnD.ECS.Developer's Avatar
    Join Date
    Feb 2010
    Location
    Fort Collins, CO
    Posts
    11

    Question Span Rows/colums in TableLayout in code.

    I found this but to no avail:
    http://www.vbforums.com/showthread.p...light=span+row

    I have generic fields and labels that I put inside already predefined table layouts. Some fields need to span rows/columns and I can't figure out how to do it within code (aka not in the designer).

    Any ideas? Any help is greatly appreciated
    Last edited by DnD.ECS.Developer; Mar 3rd, 2010 at 03:08 PM.

  2. #2

    Thread Starter
    New Member DnD.ECS.Developer's Avatar
    Join Date
    Feb 2010
    Location
    Fort Collins, CO
    Posts
    11

    Re: Span Rows/colums in TableLayout in code.

    I figured out the above issue quite soon after posting, but I'm running into another problem.

    I changed my method to take a created label which I wasn't too excited about but it got the job done. Here's the method:

    Code:
    Public Function buildBasicLabel(ByVal labelName As Label, ByVal text As String, ByVal font As Font, ByVal align As Integer)
            Dim tmpLabel
    
            If IsNothing(labelName) Then
                tmpLabel = New Label()
            Else
                tmpLabel = labelName
            End If
    
            If IsNothing(font) Then
                tmpLabel.Font = New Font(FontFamily.GenericSansSerif, 6.5)
            Else
                tmpLabel.Font = font
            End If
    
            If align = 0 Then
                tmpLabel.TextAlign = ContentAlignment.MiddleCenter
            Else
                tmpLabel.TextAlign = align
            End If
    
            tmpLabel.AutoSize = False
            tmpLabel.Margin = New Padding(0)
            tmpLabel.Text = text
            tmpLabel.Anchor = AnchorStyles.None
    
            Return tmpLabel
        End Function
    Here's sample code of how I use the method:
    Code:
    Dim spanLabel As New Label()
    
    layout.Controls.Add(cb.buildBasicLabel(spanLabel , "TESTEST", largeLabel, ContentAlignment.MiddleLeft), 2, 2)
    layout.setColumnSpan(spanLabel , 3)
    
    layout.Controls.Add(cb.buildBasicLabel(Nothing, "Misc." + vbCrLf + "Test", Nothing, Nothing), 12, 1)
    Last edited by DnD.ECS.Developer; Mar 3rd, 2010 at 04:02 PM. Reason: Opened a different issue regarding a new issue brought on by the change to avoid having multiple issues in one topic.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width