Results 1 to 4 of 4

Thread: listbox / label issues

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2008
    Location
    PA
    Posts
    365

    listbox / label issues

    Instead of making back to back posts, I figured I'll just ask two questions in this post:

    1) When displaying text in a label with autosize=false, is it possible to display as much of one word as possible until it gets cutoff. Right now, if one word is longer than where the end of the label is set to, it won't display any of that word.

    2) Is it possible to implement a down/up button that when clicked will scroll the listbox either down or up. I'm thinking of having the button change the selected index +/- 1, but will the view of the box scroll with the newly selected items?

  2. #2
    Fanatic Member stlaural's Avatar
    Join Date
    Sep 2007
    Location
    Quebec, Canada
    Posts
    683

    Re: listbox / label issues

    1) I don't think its possible, at least I don't think there's a default option for that. If the first word you enter in your label is longer than the label itself then it will display as much of that word as possible But if you enter multiple words, and let's say that the third word exceeds the label's length by a couple characters then it seems that the label will only display the first two word and won't even display the first characters of the third word, even if there would be enough space for this.
    Alex
    .NET developer
    "No. Not even in the face of Armageddon. Never compromise." (Walter Kovacs/Rorschach)

    Things to consider before posting.
    Don't forget to rate the posts if they helped and mark thread as resolved when they are.


    .Net Regex Syntax (Scripting) | .Net Regex Language Element | .Net Regex Class | DateTime format | Framework 4.0: what's new
    My fresh new blog : writingthecode, even if I don't post much.

    System: Intel i7 920, Kingston SSDNow V100 64gig, HDD WD Caviar Black 1TB, External WD "My Book" 500GB, XFX Radeon 4890 XT 1GB, 12 GBs Tri-Channel RAM, 1x27" and 1x23" LCDs, Windows 10 x64, ]VS2015, Framework 3.5 and 4.0

  3. #3
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    Re: listbox / label issues

    With number 1, you could consider adding an ellipses ( ... ) at a certain point.
    VB.NET MVP 2008 - Present

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: listbox / label issues

    Quote Originally Posted by detlion1643 View Post
    Instead of making back to back posts, I figured I'll just ask two questions in this post:
    Wrong option. Keep each thread to a single topic and each topic to a single thread. Your aim is to keep the forum organised and easy to use for everyone. Combining topics in a single thread makes things more confusing for the people posting to a thread and information harder to find for others.

    1. The Label control won't do that for you. You can use GDI+ to draw the Text yourself, using one of the overloads of Graphics.DrawString that takes a StringFormat argument. The StringFormat class has a Trimming property that can trim the drawn text in various ways.

    2. When you try it for yourself you'll know whether it works or not. Then you only need to ask if it doesn't.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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