Click here to Skip to main content
15,893,381 members
Home / Discussions / C#
   

C#

 
AnswerRe: Creating a checklist using checkbox tool in csharp smart device project Pin
Tarakeshwar Reddy21-Apr-10 9:04
professionalTarakeshwar Reddy21-Apr-10 9:04 
GeneralRe: Creating a checklist using checkbox tool in csharp smart device project Pin
Tunisien8621-Apr-10 22:53
Tunisien8621-Apr-10 22:53 
GeneralRe: Creating a checklist using checkbox tool in csharp smart device project Pin
Tarakeshwar Reddy22-Apr-10 6:23
professionalTarakeshwar Reddy22-Apr-10 6:23 
AnswerRe: Creating a checklist using checkbox tool in csharp smart device project Pin
Tunisien8622-Apr-10 6:27
Tunisien8622-Apr-10 6:27 
QuestionHow to pad a string with zeroes Pin
jkpieters21-Apr-10 4:41
jkpieters21-Apr-10 4:41 
AnswerRe: How to pad a string with zeroes Pin
OriginalGriff21-Apr-10 4:51
mveOriginalGriff21-Apr-10 4:51 
GeneralRe: How to pad a string with zeroes Pin
jkpieters21-Apr-10 4:58
jkpieters21-Apr-10 4:58 
GeneralRe: How to pad a string with zeroes Pin
OriginalGriff21-Apr-10 5:15
mveOriginalGriff21-Apr-10 5:15 
To do this while keeping it as a string will be messy:
string x = "456.78";
string[] parts = x.Split('.');
string whole = parts[0];
string decpart = parts[1];
string y = new string('0', 5 - whole.Length) + whole;
string z = decpart + new string('0', 4 - decpart.Length);
string padded = y + "." + z;
And that has no error checking!
To convert to double and back is probably the best way:
string x = "456.78";
double d = double.Parse(x, System.Globalization.CultureInfo.InvariantCulture);
string padded = string.Format("{0:00000.0000}", d);
But you will have to be absolutely sure that your number strings are all in "nnn.nn" format - remember that some cultures use "nnn,nn" which would bolox you right up! (That may be why your conversion gave funky results...)
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace

C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy

GeneralRe: How to pad a string with zeroes Pin
PIEBALDconsult21-Apr-10 6:00
mvePIEBALDconsult21-Apr-10 6:00 
GeneralRe: How to pad a string with zeroes Pin
OriginalGriff21-Apr-10 6:07
mveOriginalGriff21-Apr-10 6:07 
GeneralRe: How to pad a string with zeroes Pin
PIEBALDconsult21-Apr-10 6:17
mvePIEBALDconsult21-Apr-10 6:17 
GeneralRe: How to pad a string with zeroes Pin
OriginalGriff21-Apr-10 6:24
mveOriginalGriff21-Apr-10 6:24 
AnswerRe: How to pad a string with zeroes [modified] Pin
PIEBALDconsult21-Apr-10 5:00
mvePIEBALDconsult21-Apr-10 5:00 
AnswerRe: How to pad a string with zeroes Pin
OkkiePepernoot21-Apr-10 5:29
OkkiePepernoot21-Apr-10 5:29 
AnswerRe: How to pad a string with zeroes Pin
Luc Pattyn21-Apr-10 6:33
sitebuilderLuc Pattyn21-Apr-10 6:33 
GeneralRe: How to pad a string with zeroes Pin
PIEBALDconsult21-Apr-10 7:50
mvePIEBALDconsult21-Apr-10 7:50 
GeneralRe: How to pad a string with zeroes Pin
Luc Pattyn21-Apr-10 7:57
sitebuilderLuc Pattyn21-Apr-10 7:57 
GeneralRe: How to pad a string with zeroes Pin
PIEBALDconsult21-Apr-10 8:02
mvePIEBALDconsult21-Apr-10 8:02 
Questionwrite in a textbox Pin
Member 216810321-Apr-10 4:41
Member 216810321-Apr-10 4:41 
AnswerRe: write in a textbox Pin
sanforjackass21-Apr-10 4:52
sanforjackass21-Apr-10 4:52 
AnswerRe: write in a textbox Pin
Member 216810321-Apr-10 6:21
Member 216810321-Apr-10 6:21 
QuestionDataGridView SelectionChanged event Pin
eyalbi00721-Apr-10 4:18
eyalbi00721-Apr-10 4:18 
AnswerRe: DataGridView SelectionChanged event Pin
dan!sh 21-Apr-10 4:33
professional dan!sh 21-Apr-10 4:33 
QuestionRe: DataGridView SelectionChanged event Pin
eyalbi00721-Apr-10 4:43
eyalbi00721-Apr-10 4:43 
AnswerRe: DataGridView SelectionChanged event Pin
dan!sh 21-Apr-10 4:58
professional dan!sh 21-Apr-10 4:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.