Results 1 to 15 of 15

Thread: List box line feed

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Location
    Wollongong. NSW. Australia
    Posts
    470

    List box line feed

    G'day,

    I am populating a list box with data from a database using this ...

    VB Code:
    1. List1.Item(X).AddItem .Fields!JobNumber _
    2.                                   & vbTab & .Fields!TimeAvailable _
    3.                                   & vbTab & Left(.Fields!Couriertype, 2) _
    4.                                   & vbCrLf _
    5.                                   & vbTab & FromRs.Fields!CName _
    6.                                   & vbTab & FromRs.Fields!AddrSuburb _
    7.                                   & vbTab & ToRs.Fields!CName _
    8.                                   & vbTab & ToRs.Fields!AddrSuburb _
    9.                                   & vbCrLf _
    10.                                   & vbTab & TempString
    , but the vbCrLf doesn't work - it just gives me 2 vertical bars.

    I know I can use AddItem several times to simulate the line feed, but that's no good to me as clicking on one item won't select all the tiems in the record.

    Peter
    My reputation is in tatters. Don't bother trying to repair it.

  2. #2
    Frenzied Member Ideas Man's Avatar
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    1,718

    Re: List box line feed

    Listboxes aren't designed for that purpose I think you'll find. They are designed to list one item on one line, that's why you see the two characters representing carriage return and line feed (ControlChars.CrLf).

    Yey! My 1,400th post.
    I use Microsoft Visual Basic 2005. (Therefore, most code samples I provide will be based around the .NET Framework v2.0, unless otherwise specified)

  3. #3
    Junior Member
    Join Date
    Jan 2005
    Location
    North Italy
    Posts
    28

    Re: List box line feed

    hi..tried to use the "controlchars.CrLf" instead of vbCrLf?

  4. #4
    Frenzied Member Ideas Man's Avatar
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    1,718

    Re: List box line feed

    ControlChars.CrLf and vbCrLf are the same thing, though the former is the more correct .NET way.
    I use Microsoft Visual Basic 2005. (Therefore, most code samples I provide will be based around the .NET Framework v2.0, unless otherwise specified)

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Location
    Wollongong. NSW. Australia
    Posts
    470

    Re: List box line feed

    G'day Andy,
    Quote Originally Posted by Andyc76
    hi..tried to use the "controlchars.CrLf" instead of vbCrLf?
    It says variable not defined.

    Peter
    My reputation is in tatters. Don't bother trying to repair it.

  6. #6
    Frenzied Member Ideas Man's Avatar
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    1,718

    Re: List box line feed

    Are you sure you're entering it in correctly? It shouldn't say that, unless you don't have the correct library referenced.
    I use Microsoft Visual Basic 2005. (Therefore, most code samples I provide will be based around the .NET Framework v2.0, unless otherwise specified)

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Location
    Wollongong. NSW. Australia
    Posts
    470

    Re: List box line feed

    G'day,
    Quote Originally Posted by Ideas Man
    Are you sure you're entering it in correctly? It shouldn't say that, unless you don't have the correct library referenced.
    Yes, I copy/pasted, but the missing library is a distinct possibility. Which resource do I need?

    Peter
    My reputation is in tatters. Don't bother trying to repair it.

  8. #8
    Junior Member
    Join Date
    Jan 2005
    Location
    North Italy
    Posts
    28

    Re: List box line feed

    Hi..try to include "System"

    (Imports System), or microsoft.Visualbasic..

  9. #9
    Frenzied Member Ideas Man's Avatar
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    1,718

    Re: List box line feed

    Microsoft.VisualBasic.ControlChars is the full path to the class.
    I use Microsoft Visual Basic 2005. (Therefore, most code samples I provide will be based around the .NET Framework v2.0, unless otherwise specified)

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Location
    Wollongong. NSW. Australia
    Posts
    470

    Re: List box line feed

    G'day Andy,
    Quote Originally Posted by Andyc76
    Hi..try to include "System"

    (Imports System), or microsoft.Visualbasic..
    Sorry, you have lost me there. I'm running vb6 with sp6. What am I missing?

    Peter
    My reputation is in tatters. Don't bother trying to repair it.

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Location
    Wollongong. NSW. Australia
    Posts
    470

    Re: List box line feed

    G'day,

    Oops!!!!!!!

    My error. I am in the wrong forum.

    Peter
    My reputation is in tatters. Don't bother trying to repair it.

  12. #12
    Frenzied Member Ideas Man's Avatar
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    1,718

    Re: List box line feed

    Why did you post in the Visual Basic .NET forum then? They are two semi-'different' languages. Could a moderator please move this into classic VB?

    What we were both talking about was for .NET, not VB6.
    I use Microsoft Visual Basic 2005. (Therefore, most code samples I provide will be based around the .NET Framework v2.0, unless otherwise specified)

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Location
    Wollongong. NSW. Australia
    Posts
    470

    Re: List box line feed

    G'day,
    Quote Originally Posted by Ideas Man
    Why did you post in the Visual Basic .NET forum then? They are two semi-'different' languages. Could a moderator please move this into classic VB?

    What we were both talking about was for .NET, not VB6.
    Is stupidity a valid excuse?

    I'll go to the right forum and repost.

    Thanks for your efforts.

    Peter
    My reputation is in tatters. Don't bother trying to repair it.

  14. #14
    Frenzied Member Ideas Man's Avatar
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    1,718

    Re: List box line feed

    Or better yet, just wait for a mod to move it, that way it stays intact.

    If you are going to post it in another form, please say something like that in the title for the first message to let people browsing know that.

    Yeah, I'll forgive a fellow aussie for posting it in the wrong form
    I use Microsoft Visual Basic 2005. (Therefore, most code samples I provide will be based around the .NET Framework v2.0, unless otherwise specified)

  15. #15
    Junior Member
    Join Date
    Jan 2005
    Location
    North Italy
    Posts
    28

    Re: List box line feed

    Quote Originally Posted by Supremus
    G'day,

    Oops!!!!!!!

    My error. I am in the wrong forum.

    Peter

    LOL.. No problem..

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