[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How do I add a vertical scroll bar to a label ?

Posted on 2004-10-21
10
Medium Priority
?
681 Views
Last Modified: 2010-04-15
I am outputting data to a label in a Windows App using C#.  Some of the data is rather long and cuts off at the bottom of the label.  How can I add a vertical scroll bar to it?

ptslv
0
Comment
Question by:ptslv
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 12372087
Scrollbars belongs to TextBox and not to Label.

Use a ReadOnly textbox instead.
0
 

Author Comment

by:ptslv
ID: 12372183
OK, emoreau.  I got the textbox working with the scroll bar, but now my output has lost it's formatting.  How do I get the line returns back?

ptslv
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 12372322
is your Multiline property set to True?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:ptslv
ID: 12372558
yes
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 12372586
Then you surely don't have real carriage return into your string.
0
 

Author Comment

by:ptslv
ID: 12372600
I am using "\n" in the string.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 12372631
try replacing \n with environment.newline
0
 

Author Comment

by:ptslv
ID: 12372658
emoreau-

I tried using "\r".  It trashes the formatting in the label and doesn't do any better in the textbox.

ptslv
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 12372701
use this:

textBox1.Text = "line 1\nline2\nline3".Replace("\n",Environment.NewLine);
0
 

Author Comment

by:ptslv
ID: 12372886
emoreau,

I went back thru and replaced all the "\r" with Environment.NewLine and it worked like a charm.  Thanks!

ptslv
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question