Z zekeman Well-known member Joined May 23, 2006 Messages 224 Programming Experience 10+ Apr 20, 2007 #1 Using the string.format I can type: VB.NET: String.Format("{0,-10}", "Field") Or String.Format("{0,-10}", MyValue) CAN I replace the 10 above with a variable and how?
Using the string.format I can type: VB.NET: String.Format("{0,-10}", "Field") Or String.Format("{0,-10}", MyValue) CAN I replace the 10 above with a variable and how?
JohnH VB.NET Forum Moderator Staff member Joined Dec 17, 2005 Messages 15,800 Location Norway Programming Experience 10+ Apr 20, 2007 #2 The pattern string is a string you can build up like any other string. VB.NET: Dim variable As Integer = 22 Dim fmt As String = "{0," & variable.ToString() & "}" Dim s As String = String.Format(fmt, param) Upvote 0 Downvote
The pattern string is a string you can build up like any other string. VB.NET: Dim variable As Integer = 22 Dim fmt As String = "{0," & variable.ToString() & "}" Dim s As String = String.Format(fmt, param)