ی موردی پیش اومده
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace DGV_TEST
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
textBox1.Text = a.ToString();
}
int a = 1;
int[] array = new int[3];
int[] array2 = new int[1];
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
/* if (Convert.ToBoolean(dataGridView1.Rows[0].Cells[0].Value) == true)
{
array[0] = 1;
}
else array[0] = 0;
if (Convert.ToBoolean(dataGridView1.Rows[0].Cells[1].Value) == true)
{
array[1] = 1;
}
else array[1] = 0;
if (Convert.ToBoolean(dataGridView1.Rows[0].Cells[2].Value) == true)
{
array[2] = 1;
}
else array[2] = 0;
array2[0] = array[0] + array[1] + array[2];
textBox1.Text = array2[0].ToString();*/
}
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (Convert.ToBoolean(dataGridView1.Rows[0].Cells[0].Value) == true)
{
array[0] = 1;
}
else array[0] = 0;
if (Convert.ToBoolean(dataGridView1.Rows[0].Cells[1].Value) == true)
{
array[1] = 1;
}
else array[1] = 0;
if (Convert.ToBoolean(dataGridView1.Rows[0].Cells[2].Value) == true)
{
array[2] = 1;
}
else array[2] = 0;
array2[0] = array[0] + array[1] + array[2];
textBox1.Text = array2[0].ToString();
}
}
}
اگه تو cellcounterclick بزاریم کار انجام میشه ولی نه به محض حالت گرتفن سلول یعنی باید یه سلول دیگه مقدار دهی بشه بعد اون قبلی مقدرش تو txt به نمایش بیوفته.
ولی تو cellclick اصلا تقییرات لحاظ نمیشه!! همون عدد یکی که مونده تو txt به نمایش بیوفته و تقییرات اصلا لحاظ نمیشه.
یه کمکی دیگه ای هم کنید اینو حل کنیم.
مرسی
توسط
pouyan4938
(594 امتیاز)
●1 ●6 ●33