Bugzilla – Attachment 269688 Details for
Bug 471987
DataGridView. Empty Rows don't add default Cells
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
Example
datagridview1.cs (text/plain), 2.14 KB, created by
Mario Carrion
on 2009-02-03 15:54:04 UTC
(
hide
)
Description:
Example
Filename:
MIME Type:
Creator:
Mario Carrion
Created:
2009-02-03 15:54:04 UTC
Size:
2.14 KB
patch
obsolete
>using System; >using System.Collections.Generic; >using System.Linq; >using System.Windows.Forms; >using System.Drawing; > >namespace DataGrid >{ > static class Program > { > [STAThread] > static void Main() > { > Application.EnableVisualStyles(); > Application.SetCompatibleTextRenderingDefault(false); > Application.Run(new ExampleForm()); > } > > public class ExampleForm : Form > { > public ExampleForm () : base() > { > Size = new Size(600, 300); > > DataGridView view = new DataGridView(); > view.Size = new Size(400, 200); > view.AllowUserToAddRows = false; > view.Location = new Point(1, 1); > > DataGridViewTextBoxColumn textColumn = new DataGridViewTextBoxColumn(); > textColumn.HeaderText = "text column"; > > DataGridViewCheckBoxColumn checkBoxColumn = new DataGridViewCheckBoxColumn(); > checkBoxColumn.HeaderText = "checkbox column"; > > view.Columns.Add(textColumn); > view.Columns.Add(checkBoxColumn); > view.Rows.CollectionChanged += delegate (object sender, > System.ComponentModel.CollectionChangeEventArgs e) { > DataGridViewRow row = e.Element as DataGridViewRow; > if (row == null) > return; > > Console.WriteLine ("Action: {0} Cells.Count: {1} ColumnCount: {2} Columns.Count: {3}", > e.Action, > row.Cells.Count, > view.ColumnCount, > view.Columns.Count); > }; > > Button button = new Button(); > button.Text = "Add row"; > button.Size = new Size (70, 25); > button.Location = new Point(410, 1); > button.Click += delegate(object sender, EventArgs args) { > view.Rows.Add (new DataGridViewRow ()); > }; > > Controls.Add(view); > Controls.Add(button); > } > > } > } >} >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 471987
: 269688