具有整数,双精度和十进制的TextBox.Databindings

编程入门 行业动态 更新时间:2024-10-11 21:27:02
本文介绍了具有整数,双精度和十进制的TextBox.Databindings的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 我想将某些数据类型绑定到某些TextBoxes 这是我的代码,但是没有用.我必须要做的是代码正在运行?

hello all together, i would like to bind some datatypes to some TextBoxes here ist my code but it dosn`t work. what i have to do that the code is running?

class myContainer { protected double wall; protected decimal diameter; protected int ringcount; public double _wallthickness { get { return wall; } set { wall = value; } } public decimal _outerDiameter { get { return diameter; } set { diameter = value; } } public int _ringcount { get { return ringcount; } set { ringcount = value; } } } private void Form1_Load(object sender, EventArgs e) { myContainer container = new myContainer(); textBox1.DataBindings.Add("Text", container, "wall", true, DataSourceUpdateMode.OnPropertyChanged, string.Empty, "0.000"); textBox2.DataBindings.Add("Text", container, "diameter", true, DataSourceUpdateMode.OnPropertyChanged, string.Empty, "0.00"); textBox3.DataBindings.Add("Text", container, "ringcount", true, DataSourceUpdateMode.OnPropertyChanged, string.Empty, "0"); }

thanks for your help.

推荐答案

您使用了错误的属性名称.像这样使用 textBox1.DataBindings.Add("Text",容器,"_wallthickness",true,DataSourceUpdateMode.OnPropertyChanged,string.Empty,"0.000"); You have used wrong property name. Use like this textBox1.DataBindings.Add("Text", container, "_wallthickness", true, DataSourceUpdateMode.OnPropertyChanged, string.Empty, "0.000");

更多推荐

具有整数,双精度和十进制的TextBox.Databindings

本文发布于:2023-11-24 19:58:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1626609.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:整数   精度   十进制   TextBox   Databindings

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!