473,382 Members | 1,329 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,382 software developers and data experts.

PadRight

Is there something wrogn with this syntax? It does not put in the padded
characters.

string hk="Assembly";

hk.PadRight(35,'-');

this.textBox1.Text=hk + "Test";

The output is AssemblyTest
Nov 16 '05 #1
1 6395
John,
You never do anything with the result of PadRight, remember that PadRight is
a function that returns a new string. Remember that strings are immutable,
any String method that "modifies" a string returns a new instance of the
modified string, they do not change the specified instance of the string.

Try:
string hk="Assembly";

hk = hk.PadRight(35,'-');

this.textBox1.Text=hk + "Test";
Hope this helps
Jay

"john sutor" <john_sutor@NOSPAM> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl... Is there something wrogn with this syntax? It does not put in the padded
characters.

string hk="Assembly";

hk.PadRight(35,'-');

this.textBox1.Text=hk + "Test";

The output is AssemblyTest

Nov 16 '05 #2

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

Similar topics

1
by: jimmy chao via .NET 247 | last post by:
Hi I am having problems with using the padright function in ASP.NET. my code is string listring; string strTitle = ds.Tables.Rows.ToString().Trim(); if (strTitle.Length > 15) { strTitle =...
3
by: John A Grandy | last post by:
what's the best way in VB.NET to build a string as a concatenation of a certain number of characters ? for example, 25 "*" characters : "*************************"
2
by: Bill Nguyen | last post by:
I tried in vain to add blank space to the end of couple variables as below: mPadding = Convert.ToChar(" ") mdriverBegin.PadRight(16, mPadding) mdriverEnd.PadRight(16, mPadding) ...
20
by: djc | last post by:
I get this *intermittently* on a utility I am working on. I don't know whats going on but here are a few points about it: - using VS 2005, running on xp sp2 - program uses multiple threadpool...
2
by: lmnorms1 | last post by:
Hello, I am looking to update a record that was read in with OleDbDataReader. I have the record in reader but now with the reader connection open; how do I update it. Any advice would be...
4
by: Pascal | last post by:
hello i try to use padright and padleft to beautify the aspect of my prints. I 'd like the text to be print in two columns but i don't know the size of each string before (because they are...
3
by: MikeJ | last post by:
""NAME","SYSTEM_ID","TAX_ID","LICENSE""; the Above is one row read in from a text file its 38 bytes in width i want to pad this to 77 in my code padright is not working correctly unless i...
0
by: Paul Ilacqua | last post by:
I'm using VB .NET and I'm trying to "roll my own" report subtotals. I'm building a string from a datareader top pass to a reporting class and I want to break and subtotal QTY at each change in...
2
by: akshaycjoshi | last post by:
Refer the pic below, It's showing properly when seen in notepad but not in combobox. Here is the code OleDbDataReader trunkdr = trunkcom.ExecuteReader(); while (trunkdr.Read()) {...
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: 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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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...

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.