![](/img/trans.png)
[英]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.