Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 13th, 2008, 11:49 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default [Resolved] String - right justify value

I need to pass a value to a stored procedure. The field is JobNumber and defined as char(12) in my sp. In my program I get the JobNumber value from a TextBox. When I map to JobNumber I need to right justify the value from the TextBox with leading blanks. This is what I have done (so far)

dim JobNumber as string
JobNumber = Space(12)

Now I need to set JobNumber = TextBox.text right justfied with leading blanks. The value of the TextBox is always numeric and could be any number from 1 to 999999999999. Thank you.
 
Old November 13th, 2008, 07:44 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

mmm.. and what about
Code:
JobNumber = space(12 - textbox.text.length) & textbox.text
You can add an if before to check the length (for 0 space)... Done this a millions times ;)

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old November 14th, 2008, 10:19 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Hi gbianchi,

Worked great. Thank you very much.

 
Old November 14th, 2008, 12:29 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

np.. :)

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
text-align:justify; and <BR> anshul HTML Code Clinic 23 June 18th, 2018 03:04 AM
"The remote name could not be resolved" teddyk ASP.NET 2.0 Basics 0 October 28th, 2008 12:49 AM
Need help with saving and loading...[RESOLVED] dumpstertom Beginning VB 6 0 March 18th, 2005 12:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.