Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
460
EnterEditMode fires Enter event and throws non-fatal exception
posted

I have an ultraGrid,

my goal is when the user tabs into the grid the new template row should get activated and the first cell in Edit mode, ready to type.

i set the AllowAddNew to FixedAddRowOnBottom

then i wrote the 2 simple lines in the grids Enter event:

 

 

 

 

 

 

 

Private Sub myGrid_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles myGrid.Enter

Me.myGrid.Rows.TemplateAddRow.Cells("Column1").Activate()

 

 

 

Me.myGrid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode)

 

 

 

End Sub

What's happening is that when it execute the PerformAction method, for some reason it causes to fire again the Enter event, and attempts to run again the Cell-Activate method, and here's where it throws an IndexOutOfRangeException, description "Index 0 is either negative or above rows count."

if i resume debugging, (I hit F5), it moves on and the error reaccures 7 times, and then after resuming 7 times, it moves on and behaves normal and as expected as if nothing happend.

The only thing I can reason why the number 7, is that is co-incidently that is the count of columns in the grid.

So what I gather is that the compiler doesn't realy consider it as a FATAL error, so it lets you move on.

Another important point this symptom only accurs when there's NO rows yet in the grid.

I can release it as is and the end-user would'nt notice anything, but its definitlely not clean.

Parents
No Data
Reply
  • 18495
    posted

    Hello Mendel,

    I created a sample project using NetAdvantage 2010 Volume 3, and everything worked without any issues.  Please let me know which version of NetAdvantage you are using.

Children
No Data