Click here to Skip to main content
15,354,956 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi all

I am using C# Windows forms

binding source from dataset
can possible to binding textbox with thousand separator..?

best regards

HiMaxNaz

What I have tried:

binding textbox with thousand separator..!
Posted
Updated 18-Dec-16 15:19pm
Comments
Mehedi Shams 18-Dec-16 19:02pm
   
Hi Member 12784611, the question is not clear enough. Do you mean you want to bind a textbox to a data source, and the data comes in a thousands' separator format (like 10000 will display ase 10,000)?

Please provide your code in the "What I have tried" section. This section is meant to display your code as what you have tried.

1 solution

Hi Member 12784611,

I was waiting for your reply. So I am writing on my guess as posted in the above comment.
As long as I know you need to do the formatting before binding, and perhaps after binding the format cannot be changed. Since I don't have your code I geared up a little code as follows:
C#
DataTable DT = new DataTable();
DataColumn DC = new DataColumn();

DC.ColumnName = "Val";
DT.Columns.Add(DC);

DataRow DR = DT.NewRow();
double Dbl = 10000000000L;
DR["Val"] = Dbl.ToString("0,000");  // Formatting to thousandths.

DT.Rows.Add(DR);
textBox1.DataBindings.Add("Text", DT, "Val");
Please have some idea from here and modify your code accordingly.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900