Thank you for the tip! I cleared my previous mask setting in the Mask
property and updated my code to include your code as well:
protected void FillForm(XmlDocument oXDoc, Form pForm)
{
// Fill in each control
int n = pForm.Controls.Count - 1;
for (int i = 0; i < n ; i++)
{
// set the text of the control
string strCtrl = pForm.Controls[i].Name;
string strType =
pForm.Controls[i].GetType().ToString().Substring(pForm.Controls[i].GetType().ToString().LastIndexOf(".") + 1);
XmlNodeList xmlNode = oXDoc.GetElementsByTagName(strCtrl);
// Make sure we have something to work with
if (xmlNode.Count > 0)
{
if (strType == "TextBox")
{
pForm.Controls[i].Text = xmlNode[0].InnerText;
}
else if (strType == "MaskedTextBox")
{
pForm.Controls[i].Text = String.Format("{0:c}",
xmlNode[0].InnerText);
}
}
}
}
Again, thanks for your help!
"Cerebrus" wrote:
Hi,
Have you tried using the String.Format() method ?
as in :
Text1.Text = String.Format("{0:c}", price);
HTH,
Regards,
Cerebrus.