如何在C#windows窗体中将文本框与千位分隔符绑定..? [英] How to binding textbox with thousand separator in C# windows forms..?

查看:112
本文介绍了如何在C#windows窗体中将文本框与千位分隔符绑定..?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我正在使用C #Windows表格



来自数据集的绑定源

可以用千分隔符绑定文本框..?



最好的问候



HiMaxNaz



我尝试了什么:



绑定文本框与千位分隔符..!

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..!

推荐答案

嗨会员12784611,



我在等你的回复。所以我写的是我在上面评论中发布的猜测。

只要我知道你需要在绑定之前做格式化,也许在绑定之后格式无法改变。由于我没有你的代码,我按照以下方式编写了一些代码:

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:
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.


这篇关于如何在C#windows窗体中将文本框与千位分隔符绑定..?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆