Results 1 to 10 of 10

Thread: display static text in vb.net

  1. #1

    Thread Starter
    Addicted Member haihems's Avatar
    Join Date
    Oct 2004
    Posts
    150

    Resolved display static text in vb.net

    hi,

    I've some informations in a word document (2,3 pages). I want to show this to the user from vb.net form. How can I do this?

    Can I use Labels? But it is not look nice (the alignments are not good) and take much time to paste line by line. I'm sure there is better way to do this Need quick response...Thanks
    Last edited by haihems; Mar 11th, 2005 at 11:28 PM. Reason: resolved
    Think Before Ink

    Visual Studio .NET 2002/.NET Framework 1.0

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: display static text in vb.net

    Use a richtextbox.

  3. #3

    Thread Starter
    Addicted Member haihems's Avatar
    Join Date
    Oct 2004
    Posts
    150

    Re: display static text in vb.net

    Hi,
    Thanks for immediate response.
    I want only show the text..with richtextbox user can edit the text, right?
    Think Before Ink

    Visual Studio .NET 2002/.NET Framework 1.0

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: display static text in vb.net

    Set the ReadOnly property to true for the RTB.

  5. #5

    Thread Starter
    Addicted Member haihems's Avatar
    Join Date
    Oct 2004
    Posts
    150

    Re: display static text in vb.net

    But then why can't i use Labels inseted of RTB...what is the difference between those two. if I make readonly-true, borderstyle-None and backcolor-control..then RTB looks like Label!!! Sorry..i hope i'm not irretating anybody by this silly questions...Just want to know about .net clearly.
    Think Before Ink

    Visual Studio .NET 2002/.NET Framework 1.0

  6. #6
    Hyperactive Member Grunt's Avatar
    Join Date
    Oct 2004
    Location
    Las Vegas
    Posts
    499

    Re: display static text in vb.net

    make sure you set the rtb to multiline... Labels are only for a few words at the most. They are as their name suggest, to label things. You need an RTB or even a regular textbox would be ok.

  7. #7

    Thread Starter
    Addicted Member haihems's Avatar
    Join Date
    Oct 2004
    Posts
    150

    Re: display static text in vb.net

    Is RTB is the only way to show the text to the user. I have more than 2 pages of text in word document. I did the following coding to put the word document text in to RTB.

    VB Code:
    1. RichTextBox1.Text = "This is the first line" _
    2.                             & vbCrLf _
    3.                             & "This is the second line" _
    4.                             & vbCrLf _
    5.                             & "This is the third line" _
    6.                             & vbCrLf _
    7.                             & "This is the fourth line" _
    8.                             & vbCrLf _
    9.                             & "This is the fifth line"

    Am i doing correctly?
    Last edited by haihems; Mar 11th, 2005 at 09:50 PM.
    Think Before Ink

    Visual Studio .NET 2002/.NET Framework 1.0

  8. #8
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622

    Re: display static text in vb.net

    You could also just save the word document as a .rtf and then load the document a runtime

    VB Code:
    1. RichTextBox1.Load("C:\My Path\My File.rtf")
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

  9. #9

    Thread Starter
    Addicted Member haihems's Avatar
    Join Date
    Oct 2004
    Posts
    150

    Re: display static text in vb.net

    Quote Originally Posted by <ABX
    You could also just save the word document as a .rtf and then load the document a runtime

    VB Code:
    1. RichTextBox1.Load("C:\My Path\My File.rtf")
    Thanks...it helps me to show the text...
    but the syntax is...

    VB Code:
    1. RichTextBox1.LoadFile("C:\My Path\My File.rtf")
    Big thanks to everybody
    Think Before Ink

    Visual Studio .NET 2002/.NET Framework 1.0

  10. #10
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622

    Re: display static text in vb.net

    Quote Originally Posted by haihems
    Thanks...it helps me to show the text...
    but the syntax is...

    VB Code:
    1. RichTextBox1.LoadFile("C:\My Path\My File.rtf")
    Big thanks to everybody
    Argh.. My memorys letting up on me
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

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