CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2008

    Question DisplayFormat/DisplayStyle property of TextBox (Visual Studio 2010, .Net Framework 4)

    Is there any predefined property by which I can set the DisplayFormat/DisplayStyle of a textbox? Suppose I want a textbox to hold the actual value 888888888888.88 and show it formatted as 888,888,888,888.88. In short it should hold 'Double' data type value and show it with thousand separators and decimal places upto two digits. If text is cleared from the textbox, it should have 0 as value and 0.00 as displayed value. Also the number of digits in the textbox may vary accordingly. So how can it be done? Please help. Regards.

  2. #2
    Join Date
    Jan 2006
    Fox Lake, IL

    Re: DisplayFormat/DisplayStyle property of TextBox (Visual Studio 2010, .Net Framewor

    For calculations, you have to keep the data type consistent. For DISPLAY data, you can convert to string, and use String.Format() to produce whatever you'd like.

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jul 2001
    Sunny South Africa

    Re: DisplayFormat/DisplayStyle property of TextBox (Visual Studio 2010, .Net Framewor

    Or use a MaskedTextBox

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

By using this site, you agree to the Privacy Policy