PDA

View Full Version : سوال: ایجاد یک button column در datagridview



systam
شنبه 27 شهریور 1395, 17:18 عصر
سلام دوستان
من میخوام یک ستون دکمه در گرید ویو ایجاد کنم به وسیله این تیکه کد



private void CreateUnboundButtonColumn()
{
// Initialize the button column.
DataGridViewButtonColumn buttonColumn =
newDataGridViewButtonColumn();
buttonColumn.Name="Details";
buttonColumn.HeaderText="Details";
buttonColumn.Text="View Details";


// Use the Text property for the button text for all cells rather
// than using each cell's value as the text for its own button.
buttonColumn.UseColumnTextForButtonValue=true;


// Add the button column to the control.
dataGridView1.Columns.Insert(0, buttonColumn);
}

عکس هم از گرید ویو گذاشتم

142651
این کد رو دقیقا کجا بزارم درست کار کنه
اگه توی یک باتن بزارم برای بار اول درست کار میکنه
بار دوم که باتن میزنم باتن ها دوتا میشه
با هر بار کالید روی باتن دکمه به گرید ویو اضافه میشه
چیکارکنم
ممنون میشم راهنماییم کنید