I'm updating a project created by someone who is not with our company currently, and I'm attempting to add a section which formats input before spitting it out. I'm using the Format() function, but it is not applying correctly. Here's testing code I created to try to debug this issue:
the first message box displays the values entered in the textboxes correctly; the second code displays @@@@, 0, and MM d yyyy, respectively, instead of displaying formatted values.
I wondered if there is a reference library that may not have been included with the original project, since it was converted from Visual Basic 2006. If so, which library should I look for? If not, can anyone see something wrong with the way I am using the Format() function?
Cheryl dc Kern
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strText As String, intNum As Integer, strDate As String
strText = Me.txtText.Text
intNum = Me.txtNum.Text
strDate = Me.txtDate.Text
Dim MsgText As String
MsgText = "Text = " & strText & "; Number = " & intNum & "; Date = " & strDate
MsgBox(MsgText)
strText = Format(strText, "@@@@")
intNum = Format(intNum, "##0.0000")
strDate = Format(strDate, "MM d yyyy")
MsgText = "Text = " & strText & "; Number = " & intNum & "; Date = " & strDate
MsgBox(MsgText)
End Sub
the first message box displays the values entered in the textboxes correctly; the second code displays @@@@, 0, and MM d yyyy, respectively, instead of displaying formatted values.
I wondered if there is a reference library that may not have been included with the original project, since it was converted from Visual Basic 2006. If so, which library should I look for? If not, can anyone see something wrong with the way I am using the Format() function?
Cheryl dc Kern