Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Formatting Text - DataBindings

$
0
0
I'm running VS C# 2013.In my SQL Server database, the field "price_per_sq_ft" is a varchar. When it binds to its textbox, I'd like to prepend a "$" so that, say, "831" shows in the textbox as "$831". All I can find online are examples of how to format numbers/dates/etc as text but nothing on formatting text as text. I need the flexibility provided by String.Format but applied to binding.  Below is as far as I got.
tbprice_per_sq_ft.DataBindings.Add(new Binding("Text", bs, "price_per_sq_ft"));
tbprice_per_sq_ft.DataBindings[0].FormattingEnabled = true;
tbprice_per_sq_ft.DataBindings[0].FormatString = ???;


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>