473,379 Members | 1,355 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,379 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 9411
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. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.