Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Using enter key on hierachy columns result in error!

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

Using enter key on hierachy columns result in error!
Link Posted: 22-Sep-2007 06:17
Sebastian,

Thanks. I'll report back here ASAP.
Link Posted: 22-Sep-2007 06:33
Sebastian,

I'm getting null reference exception.
It happens when FlyGrid has no data in it.

Also, I do not have errors when adding some non-empty datasource:

public Form1()
{
    InitializeComponent();
    DataTable data = new DataTable();
    data.Columns.Add();
    data.Rows.Add(\"val1\");
    flyGrid1.Rows.DataSource = data;
}



Do you experience the same issue in this application? (you stated \"Index out of bounds\" exception at your first post)
Link Posted: 23-Sep-2007 21:44
Hello,

i have digged deeper into the problem:

I am using the \"GetCount()\" Method to get the number of rows to be drawn. And i have a parent who has zero children. After this number has been determined, i return this number.

return DataTableProvider.Instance.GetPeriodTableByIndex(sender.Index).Rows.Count;

The sender.Index is 1, the number of PeriodTables is 6. So it cannot come from here.

Whats more...after i return the number no other code is invoked but an exception thrown. So i wonder where this might come from.

Regards,

Sebastian
Link Posted: 23-Sep-2007 22:39
Hello,

here the full GetCount() Method:


private int VM_GetCount(NodeBase sender)
        {
            if (sender is VirtualRootNode)
            {
                try
                {
                    return DataTableProvider.Instance.GetDataTable().Rows.Count;
                }
                catch(Exception ex)
                {
                    Siemens.Diagnostics.Trace.WriteLine(\"Error while trying to get count for datatable: \" + ex, \"JournalView\");
                }
            }

            if (sender.Parent is VirtualRootNode)
            {
                try
                {
                    return DataTableProvider.Instance.GetPeriodTableByIndex(sender.Index).Rows.Count;
                }
                catch (Exception ex)
                {
                    Siemens.Diagnostics.Trace.WriteLine(\"Error while trying to get count for datetable: \" + ex, \"JournalView\");
                }
            }

            return 0;
        }
Link Posted: 24-Sep-2007 00:54
There seems nothing criminal in GetCount method.
The exception (see stack trace at your top post) comes from FlyGrid.

Anyway it seems you're doing something specific that brings flygrid into error. Could you add some more code to the test case you sent me before, so that it will cause any problems?
Link Posted: 24-Sep-2007 01:42
Hello,

i seems its a problem originally in the hierachy column.

What i have found is that when you select another cell then the cell in the hierachy column the error does not appear.

I have set the option of the flygrid in that way that it does not select a cell but a row (optically).

How can i catch the event that i have selected a cell and then set it to another cell. I know it sounds bit dirty...but i need a workaround ASAP.

Regards,

Sebastian
Link Posted: 24-Sep-2007 04:04
Probably you need to use NodeCellFocusChange event.
Link Posted: 24-Sep-2007 22:40
How can i set the selected column to another one in case cell 0 (column 0) was selected?

Regards,

Sebastian
Link Posted: 24-Sep-2007 22:56
Okay,

i solved the problem by using the \"FlyGrid.SelectCell\" - Method.

I still wonder why it causes problems when its a hierachy column that i select.

Regards,

Sebastian
Link Posted: 24-Sep-2007 23:09
Sebastian,
If we'll be able to repeat the issue locally, then we'll have much more chances to fix it.