CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 1999
    Location
    Australia
    Posts
    39

    Label Box Question......Must See

    Hi,
    How do i show items in a label box in a particular format? For Eg: Suppose i have to show items in a column and row format on a label when the items to be displayed are not permanant as they are coming from a database.
    thanks in advance,
    Derek
    PS: By the way i am using a treview control so when a particular node has the focus it will display all the items that come under that particular selected item from the database.


  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Label Box Question......Must See

    Placing them in 1 column isn't so hard, for more columns I don't have a solution (yet). U can use the vbCrlf to start a new line in a label, like this

    label1.caption = "line1" & vbcrlf & "line2" & vbcrlf & "line3"

    wich results in the label looking like this:
    line1
    line2
    line3

    For more columns you might try to add a tab between them, but I don't know if that's goint to work. Whitespaces are another solution, but only when you use a monospace font (a font where all the characters have the same width). But most fonts are not(like this i will be smaller than this m). If you do use a monospace font, be sure to include it with your installation file, because if you don't, and the user hasn't got that font, it will look screwed up.

    Tom Cannaerts
    [email protected]

    The best way to escape a problem, is to solve it.
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  3. #3
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: Label Box Question......Must See

    You can use vbCrlf and vbtab to allign the items in lines and colums.

    With tab ofcourse, you have to have an idea as to what is the Max widths of all the elements in that column. Otherwise, it will go into next column, which will look bad!.

    Better than that would be a listview with no
    headers, and flat border sytle, etc to make it look as lean as possible.
    check it out!


    RK

  4. #4
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: Label Box Question......Must See

    hI
    I am sorry for the wrong response. I posted it w/o testing.

    vbTab cannot be used for column seperation. sorry
    May be you could try my other suggestion!

    RK

  5. #5
    Join Date
    Jul 1999
    Location
    Australia
    Posts
    39

    Re: Label Box Question......Must See

    Thanks for your help,
    Derek


  6. #6
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Label Box Question......Must See

    I just got another idea, for each column, add a label. The probably is a better way, but hey, it works.

    Tom Cannaerts
    [email protected]

    The best way to escape a problem, is to solve it.
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  7. #7
    Guest

    Re: Label Box Question......Must See

    Hi,
    It's me Derek. thanks alot Cakkie for the idea, but i need the fieldname and the data to be displayed from the database.
    thanks alot for the idea again,
    Derek


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

Featured