[英]I want to add CheckBox Value into DataGridView without Database in C#
[英]C# I want to add the Value data in datagridview with looping statement
嗨,我想在此代码的datagridview中添加值数据;
int tsp;
double mf, tcp, interest, disc;
int a, b;
double MP;
if (comboBox1.Text == "Deferred Cash Payment in 2 years at 0% interest")
{
a = int.Parse(textBox3.Text);
b = int.Parse(textBox4.Text);
tsp = a * b;
mf = tsp * 0.07;
tcp = mf + tsp;
label8.Text = tcp.ToString("₱000,000.00");
MP = tcp / 24;
MP变量具有数据; 我想在带有24行循环语句的datagridview中显示它。 我想要这样的输出:
例如
Days Amount
1 10,000
2 10,000
3 10,000
4 10,000
5 10,000
..
24 10,000
在Windows窗体应用程序中,您可以创建一个新的DataTable实例,并将该DataTable绑定到DataGridView,如下所示;
您的值应显示在您的DataGridView中。 您所做的更改将直接发送到DataGridView。
DataTable dt = new DataTable();
dt.Columns.Add("Days", typeof(int));
dt.Columns.Add("Amount", typeof(decimal));
dt.Rows.Add(1, 10.00m);
dt.Rows.Add(2, 10.00m);
dt.Rows.Add(3, 10.00m);
dt.Rows.Add(4, 10.00m);
dt.Rows.Add(5, 10.00m);
dt.Rows.Add(24, 10.00m);
dataGridView1.DataSource = dt;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.