How to set mulitline edit feature in Datagridview

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi all
C# visuall express
In Datagridview how I can WorkDetails column as multiline edit column. Following are the code of my form1 screen.

<pre>namespace WindowsFormsApplication1
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.WorkDate = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.WorkDetails = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.WorkDone = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.SuspendLayout();
//
// dataGridView1
//
this.dataGridView1.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.WorkDate,
this.WorkDetails,
this.WorkDone});
this.dataGridView1.Location = new System.Drawing.Point(-3, 5);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.RowTemplate.DefaultCellStyle.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView1.RowTemplate.Height = 20;
this.dataGridView1.Size = new System.Drawing.Size(1056, 500);
this.dataGridView1.TabIndex = 0;

//
// WorkDate
//
dataGridViewCellStyle3.Format = "d";
dataGridViewCellStyle3.NullValue = null;
this.WorkDate.DefaultCellStyle = dataGridViewCellStyle3;
this.WorkDate.HeaderText = "Date";
this.WorkDate.Name = "WorkDate";
//
// WorkDetails
//
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopLeft;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.WorkDetails.DefaultCellStyle = dataGridViewCellStyle4;
this.WorkDetails.HeaderText = "Description";
this.WorkDetails.Name = "WorkDetails";
this.WorkDetails.Width = 500;
//
// WorkDone
//
this.WorkDone.HeaderText = "Work Done";
this.WorkDone.Name = "WorkDone";
this.WorkDone.Width = 400;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1051, 264);
this.Controls.Add(this.dataGridView1);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.DataGridViewTextBoxColumn WorkDate;
private System.Windows.Forms.DataGridViewTextBoxColumn WorkDetails;
private System.Windows.Forms.DataGridViewTextBoxColumn WorkDone;
}
}

[/code]

Please help
<hr class="sig polachan

View the full article
 
Back
Top