Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Activate first column in DataGrid after add
Message
From
27/12/2006 15:25:14
 
 
To
All
General information
Forum:
ASP.NET
Category:
Forms
Title:
Activate first column in DataGrid after add
Miscellaneous
Thread ID:
01180572
Message ID:
01180572
Views:
60
I have .NET 1 WinForms DataGrid bound to DataTable in C#
When new line is added, first column must become active.

How to implement this ?

To reproduce:

1. Run the code
2. Enter data to second column
3. Press down arrow key

Observed:

Second column in active

Expected:

First column must be active
using System.Windows.Forms;
using System.Data;
static class Program {
	static void Main() {
		Application.Run(new Frm());
		}
	}

class Frm: Form {
	public Frm() {
		DataTable table = new DataTable();
		DataColumn column1 = new DataColumn();
		DataColumn column2 = new DataColumn();
		DataGrid grid = new DataGrid();
		table.Rows.Add();
		grid.Dock = DockStyle.Fill;
		table.Columns.Add(column1);
		table.Columns.Add(column2);
		Controls.Add(grid);
		grid.SetDataBinding(table, "");
		}
	}
Andrus
Reply
Map
View

Click here to load this message in the networking platform