?
Solved

How to make a string aligned (Left and Right) in a text box

Posted on 2004-04-29
9
Medium Priority
?
152 Views
Last Modified: 2010-05-02
How can I make the string that are encoded in a text box be Left justified and Right justified. Just like when using MS Word where in you make the paragraph aligned both at the Left and Right margin
0
Comment
Question by:Jozin
  • 4
6 Comments
 
LVL 9

Expert Comment

by:p_sie
ID: 10947328
If you want all the text in a textbox aligned to one side, then use the alignment property of the textbox.

Textbox1.Alignment = 0 (left-align)
Textbox1.Alignment = 1 (right-align)
Textbox1.Alignment = 2 (center-align)

If you want left and right align in one textbox, I don't know
0
 

Author Comment

by:Jozin
ID: 10947673
Thanks,

What I want to know is Left and Right alignment at the same time.
0
 
LVL 9

Accepted Solution

by:
p_sie earned 200 total points
ID: 10947723
Don't think that is possible in a textbox
Maybe you could use the rich textbox (add it in the component list) there you have the setalignment property, which you can set per paragraph.
0
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.

 
LVL 9

Expert Comment

by:p_sie
ID: 10948679
Tested something:

do the following
add a rich text control to a form and name it RT
add a button to the form

paste the following code in the form's code window

Private Sub Command1_Click()

    RT.SelAlignment = 1
End Sub

Private Sub Form_Load()

    RT.Text = "Bike" & vbCrLf & "test" & vbCrLf & vbCrLf & "car"
   
End Sub

now select a line and press the button, the line will be rightaligned!
to make it center aligned use  RT.SelAlignment = 2 and left aligned : RT.SelAlignment = 0

Good luck
0
 
LVL 9

Expert Comment

by:p_sie
ID: 11257212
I think I gave all the info what the asker needed!
0
 
LVL 22

Expert Comment

by:DarkoLord
ID: 11977340
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
Accept p_sie's comment as an answer

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

DarkoLord
EE Cleanup Volunteer
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month16 days, 5 hours left to enroll

850 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