Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Select first row using code...

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

Select first row using code...
Link Posted: 10-Sep-2005 02:52
What would be the code to make flygrid select it's first row in it's grid?

Thanks inadvance

Simon
Link Posted: 11-Sep-2005 04:27
This example shows how to select some row in the FlyGrid.
[C#]
public void SelectRow(FlyGrid flyGrid, int row)
{
   if (flyGrid != null && row >= 0 && row < flyGrid.Rows.Items.Count)
  {
    NodeBase node = flyGrid.Rows.GetNodeFromRow(row);
    flyGrid.Selected = node;
  }
}
Link Posted: 12-Sep-2005 06:34
Thanks for the code, it selects the row but does not fire the onclick event for the flygrid.

Is there a way to acheive this???

Thanks

Simon
Link Posted: 12-Sep-2005 08:25
In this case, you can create control inheritor and internally call OnNodeClick method.
Link Posted: 28-Sep-2005 00:44
Would it be possible for you to give me an example as I am unsure how to achieive this.

Thank you

Simon
Link Posted: 28-Sep-2005 00:47
Would it be possible for you to give me an example as I am unsure how to achieive this.

Thank you

Simon
Link Posted: 29-Sep-2005 18:32
Hi

May by this is not in 100% managed but can help you:

1. You must import fonction:
[System.Runtime.InteropServices.DllImport("User32.dll")]
static extern int SendMessage(IntPtr hWnd, uint uMsg, uint wParam, uint lParam);

2. Constants declaration
static uint VK_HOME = 0x024;
static uint VK_UP   = 0x026;
static uint VK_DOWN = 0x028;
static uint VK_END   = 0x023;
static uint WM_KEYDOWN = 0x0100;

3. Set focus to flygrig table
this.table.Select();

4. Fire events
// First element
SendMessage(this.table.Handle,WM_KEYDOWN,VK_HOME,0);
// Previous element
SendMessage(this.table.Handle,WM_KEYDOWN,VK_UP,0);
// Nextr element
SendMessage(this.table.Handle,WM_KEYDOWN,VK_DOWN,0);
// Last element
SendMessage(this.table.Handle,WM_KEYDOWN,VK_END,0);

I hope this help You

Robert