-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>MAVhROfBvEinTEDWXh+tlw==</Id>
// in formload
DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = "MyTable";
this.dataGrid1.TableStyles.Add(ts);
this.dataGrid1.DataSource = dt;
DataGridTextBoxColumn tbc = ts.GridColumnStyles[2] as DataGridTextBoxColumn;
tbc.TextBox.KeyPress += new KeyPressEventHandler(TextBox_KeyPress);
tbc.TextBox.KeyDown += new KeyEventHandler(TextBox_KeyDown);
//the handlers
private void TextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if(this.dataGrid1.CurrentRowIndex == 2)
e.Handled = true;
}
private void TextBox_KeyDown(object sender, KeyEventArgs e)
{
if(this.dataGrid1.CurrentRowIndex == 2 && e.KeyCode == Keys.Delete)
e.Handled = true;
}
==============================
Clay Burch, .NET MVP
Visit www.syncfusion.com for the coolest tools
"paritosh upmanyu via .NET 247" <anon...@dotnet247.com> wrote in message
news:%23s4jDtP...@TK2MSFTNGP11.phx.gbl...