<p>I am attempting to set an asp.net textbox to a SQL 2005 money data type field, the initial result displayed to the user is 40.0000 instead of 40.00.
In my asp.net textbox control I would like to only display the first 2 numbers after the decimal point e.g. 40.00</p>

<p>What would be the best way to do this?
My code is below:</p>

<pre><code>this.txtPayment.Text = dr["Payment"].ToString();
</code></pre>

[{'answer_id': 38611, 'author': 'YonahW', 'author_id': 3821, 'author_profile': 'https://Stackoverflow.com/users/3821', 'pm_score': 3, 'selected': True, 'text': '<pre><code>this.txtPayment.Text = string.Format("{0:c}", dr[Payment"].ToString());\n</code></pre>\n'}, {'answer_id': 38613, 'author': 'Jason Navarrete', 'author_id': 3920, 'author_profile': 'https://Stackoverflow.com/users/3920', 'pm_score': 0, 'selected': False, 'text': '<p>Use the <em>ToString</em> method with "c" to format it as currency.</p>\n\n<pre><code>this.txtPayment.Text = dr["Payment"].ToString("c");\n</code></pre>\n\n<p><a href="http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx" rel="nofollow noreferrer">Standard Numeric Format Strings</a></p>\n'}, {'answer_id': 38616, 'author': 'Matt Hamilton', 'author_id': 615, 'author_profile': 'https://Stackoverflow.com/users/615', 'pm_score': 2, 'selected': False, 'text': '<p>Does the "c" format string work on ASP.NET the same way as it does in, say, Windows Forms? Because in WinForms I\'m fairly certain it obeys the <em>client\'s</em> currency settings. So even if the value is stored in US Dollars, if the client PC is set up to display Yen then that\'s the currency symbol that\'ll be displayed. That may not be what you want.</p>\n\n<p>It may be wiser if that\'s the case to use:</p>\n\n<pre><code>txtPayment.Text = dr["Payment"].ToString("00.00")\n</code></pre>\n'}, {'answer_id': 38630, 'author': 'Jon Limjap', 'author_id': 372, 'author_profile': 'https://Stackoverflow.com/users/372', 'pm_score': 0, 'selected': False, 'text': '<p>@Matt Hamilton</p>\n\n<p>It does. "c" works for whatever the CurrentCultureInfo is, the question becomes if all the users of the web application have the same currency as the server, otherwise, they will need to get the cultureinfo clientside and use the currency gleaned from there.</p>\n'}, {'answer_id': 39799, 'author': 'Ron Skufca', 'author_id': 4096, 'author_profile': 'https://Stackoverflow.com/users/4096', 'pm_score': 0, 'selected': False, 'text': '<p>After some research I came up with the following:</p>\n\n<pre><code>string pmt = dr["Payment"].ToString();\ndouble dblPmt = System.Convert.ToDouble(pmt);\nthis.txtPayment.Text = dblPmt.ToString("c",CultureInfo.CurrentCulture.NumberFormat);\n</code></pre>\n\n<p>I am going to test all code samples given. If I can solve this with one line of code then thats what I am going to do.</p>\n'}]
['https://Stackoverflow.com/questions/38602', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4096/']