A Repasky

A Repasky

  • NA
  • 231
  • 183.1k

Formatting string in C#

Jun 3 2011 10:00 AM
How can I format the string below like it was in VB6?  I need it in C#.  Sometime the SSN starts with a "0" and it would change to a space so the VB6 code was writing below.  How can I do it in C#?

tDetail.EmployeeSSN = Format("" & !EmployeeSocialSecurity, "000000000")

I did it this way and showed it to the lead programmer and he said to research it and do it another way.

tDetail.EmployeeSSN = string.Format("" + item["EmployeeSocialSecurity"].ToString(), "000000000");


I am relatively new to C# and some .NET. I researched this and I do not know what he means!



Thanks ahead of time,
aar





Answers (5)