Mp4 在运行时c#.NET向文本框添加值
如何在文本框的更改事件中添加文本框的值?Mp4 在运行时c#.NET向文本框添加值,mp4,Mp4,如何在文本框的更改事件中添加文本框的值? 谢谢。这是给你的电传输出 using Microsoft.VisualBasic; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Diagnostics; public class Form1 { private int iTotal; //// add remaining TextBoxe
谢谢。这是给你的电传输出
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
public class Form1
{
private int iTotal;
//// add remaining TextBoxes here.
private void myCoolTextBoxes_TextChanged(System.Object sender, System.EventArgs e)
{
iTotal = 0;
//// reset.
//// loop thru all controls on Form.
foreach (Control ctl in this.Controls) {
//// locate TextBoxes that .Name.StartsWith...
if (ctl is TextBox & ctl.Name.StartsWith("TxtPPproduct")) {
if (!string.IsNullOrEmpty(ctl.Text))
iTotal += Convert.ToInt32(ctl.Text);
//// if not a empty value in TextBox, add to Total.
}
}
txtTOTAL.Text = Convert.ToString(iTotal);
//// Display total in your TOTAL TextBox.
}
}
注意:请确保您将telerik设置为“vb到c”,而不是“c到vb”,这样它就不会出现错误……@y0io他没有说是。。。