473,406 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Right Justify Textbox

How do I right justify input data in a textbox? I have some textboxes that
are used to input numbers, and I would like to right justify them.
Aug 10 '05 #1
6 9413
Here's how to do it (assuming textbox is named myTextBox)

myTextBox.TextAlign = HorizontalAlignment.Right;
Hope this helps :-)

Brian Delahunty
Ireland

http://briandela.com/blog
"Leonard" wrote:
How do I right justify input data in a textbox? I have some textboxes that
are used to input numbers, and I would like to right justify them.

Aug 10 '05 #2
Hi Brian,
I am using a textbox on a web application, and I also want to right
justify on some cells in a datagrid, while editing. The textbox doesn't
allow for TextAlign. I checked the help, and it looks like this may be for a
windows form. I thought there might be something under styles or controls,
but haven't been able to find anything.

"Brian Delahunty" wrote: Here's how to do it (assuming textbox is named myTextBox)

myTextBox.TextAlign = HorizontalAlignment.Right;
Hope this helps :-)

Brian Delahunty
Ireland

http://briandela.com/blog
"Leonard" wrote:
How do I right justify input data in a textbox? I have some textboxes that
are used to input numbers, and I would like to right justify them.

Aug 11 '05 #3
Ahok, sorry, I assumed it was Windows Forms.

Just do this for ASP.NET:

<asp:TextBox id="TextBox1" dir=rtl runat="server"></asp:TextBox>

I'm not sure if there is a programatic way to do this.

Hope that helps.

--
Brian Delahunty
Ireland

http://briandela.com/blog

INDA SouthEast - http://southeast.developers.ie/ - The .NET usergroup I
started in the southeast of Ireland.
"Leonard" wrote:
Hi Brian,
I am using a textbox on a web application, and I also want to right
justify on some cells in a datagrid, while editing. The textbox doesn't
allow for TextAlign. I checked the help, and it looks like this may be for a
windows form. I thought there might be something under styles or controls,
but haven't been able to find anything.

"Brian Delahunty" wrote:

Here's how to do it (assuming textbox is named myTextBox)

myTextBox.TextAlign = HorizontalAlignment.Right;
Hope this helps :-)

Brian Delahunty
Ireland

http://briandela.com/blog
"Leonard" wrote:
How do I right justify input data in a textbox? I have some textboxes that
are used to input numbers, and I would like to right justify them.

Aug 11 '05 #4

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim frm As Control = Me.FindControl("Form1")
Dim ctl As Control
For Each ctl In frm.Controls
If TypeOf ctl Is TextBox Then
DirectCast(ctl, TextBox).Style("TEXT-ALIGN") = "right"
End If
End Sub

u can changed left, center.
regards,

Leonard wrote:
How do I right justify input data in a textbox? I have some textboxes that
are used to input numbers, and I would like to right justify them.

Aug 14 '05 #5
asp doesn't have property alignment.
Leonard wrote:
How do I right justify input data in a textbox? I have some textboxes that
are used to input numbers, and I would like to right justify them.

Aug 14 '05 #6
Hi Supra,
Exactly what I needed.

Thanks, Leonard

"Supra" wrote:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim frm As Control = Me.FindControl("Form1")
Dim ctl As Control
For Each ctl In frm.Controls
If TypeOf ctl Is TextBox Then
DirectCast(ctl, TextBox).Style("TEXT-ALIGN") = "right"
End If
End Sub

u can changed left, center.
regards,

Leonard wrote:
How do I right justify input data in a textbox? I have some textboxes that
are used to input numbers, and I would like to right justify them.

Aug 15 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: David Holmes | last post by:
Hi Acc 97 is it possible to right justify numbers in a list box Thanks in advance Dave Holmes
2
by: jwatts | last post by:
Hello group, I am feeling pretty good about this program. I am just learning and am trying to get the basics down. I would like to ask if someone could tell me how to right justify the BALANCE...
1
by: Kevin R | last post by:
Hi All, I am using for(i = . . . . .) sw.WriteLine(string.Format("{0} {1}", num1, num2)); and I am getting 12 123
2
by: Tina | last post by:
Is there any way to get the text property to right justify in controls like Hyperlink buttons and labels? Thanks, T
2
by: John Wilson | last post by:
Here's a dumb question from a learner: In a datagrid in a web page, how do I right justify a column of figures? I bet its easy once you know. John Wilson
8
by: Leonard | last post by:
How do I right justify input data in a textbox? I have some textboxes that are used to input numbers, and I would like to right justify them.
9
by: JG | last post by:
I'm new obviously to html and I'm looking for a way put an image on the right side of the page opposite text on the left. How does one do this? I've heard of text wrapping of an image but not sure...
5
by: tshad | last post by:
I have a datagrid that I cannot get to right justify a money amount (which is just a label). No matter what I do - it still right justifies it. <asp:TemplateColumn Visible="true"...
2
by: eighthman11 | last post by:
Hello everyone, I'm using Access 2000 and SQL 8.0 This maybe easy but I can't figure it out. I have a linked access table to a SQL server table. I use this table on a Grid on an Access form. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.