Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Software Development
Tag Cloud
access acer asus bios bsod computer crash desktop dns driver drivers error ethernet excel freeze gaming graphics hard drive hardware hdmi internet laptop malware memory monitor motherboard network printer problem ram registry repair router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Software Development >
Aligning TextBox text

Reply  
Thread Tools
sidbro's Avatar
Junior Member with 7 posts.
 
Join Date: Sep 2003
28-Sep-2006, 02:38 PM #1
Aligning TextBox text
I am using VB.Net 2003 . I need some help in coding TextBox data - Specifically
aligning text left justified ,and, other text right justified on the same line(s) in
a multiline TextBox. e.g...Account name ,left - Acount amount ,right
I have searched for help, but have not found any refernces
Help!
eddie5659's Avatar
Computer Specs
Moderator & Malware Removal Specialist with 25,165 posts.
 
Join Date: Mar 2001
Location: Bradford, England
01-Oct-2006, 10:19 AM #2
Hiya

I've moved you to Development for more response

eddie
dquigley's Avatar
Computer Specs
Senior Member with 112 posts.
 
Join Date: Apr 2006
Location: Woodinville, WA
Experience: Advanced
01-Oct-2006, 12:25 PM #3
The TextBox control doesn't have the capability to split alignment by line. I don't think the RichTextBox control does either. If you are generating the text and using a fixed font in the control (like courier) , you can pad the line of text yourself:

Code:
    Class Account
        Public AcctName As String
        Public Balance As Single
    End Class

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim MaxLine As Integer
        MaxLine = 80

        Dim Accounts As New Collection
        Dim Acct As Account

        Acct = New Account
        Acct.AcctName = "Bob Smith"
        Acct.Balance = 22123.45
        Accounts.Add(Acct)

        Acct = New Account
        Acct.AcctName = "Tex Jones"
        Acct.Balance = -2345.45
        Accounts.Add(Acct)

        Dim temp As String
        For Each Acct In Accounts
            temp = Acct.Balance.ToString("$#,##0.00 ;($#,##0.00);Zero")
            TextBox1.Text += Acct.AcctName.PadRight(MaxLine - Len(temp)) & temp & Chr(13) & Chr(10)
        Next
    End Sub
Best,
Dan
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 08:10 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.