Hi all,
I'm very very new to all this so in the hope I don't sound like a crazed old woman let me try and explain what I need help with.
My application is written in vb,I have a ultragrid loaded with accno and accname, etc, when the user make the row active, the wrest of the accounts details are displayed in fields below the grid. When the user has "worked" the account and saved, the account falls of the grid and the next row is automatically loaded. This I have done using the grid index, the best way? I don't know but it works for now. However, when the user drags the column headers to change the view to the grouping view, of course it doesn't work. I have been going arround in circles trying to find out how I reference where the user is in the grid and what would be the next row to load. Can you help me 1 with how I even know the grid view has changed to a grouping view and then how I find out where in the grid the user is.
Hope I don't sound too confused???
Trudy
Hi Mike,
Yep, I realised later on what I was doing wrong and I managed to figure it out. Thanks for your help, you obviously enspired me.
Hhi Trudy,
You're still using the index to pass into LoadNext and using the index on the root-level rows collection. So you are activating a GroupByRow. tThe Exception you are getting is because a GroupByRow has no Cells.
So that's not going to work. Instead of passing in the index to loadnext, pass in the UltraGridRow itself and call Activate on the row.
Hi Mike
I am using UltraWebGrid, the application was original web based hence the naming of the grid, I am converting it windows forms. I picked up some of your suggestions from you last post and changed my code as such:
If row.HasNextSibling Then
row = row.GetSibling(Infragistics.Win.UltraWinGrid.SiblingRow.Next)
Else
If row.HasPrevSibling Then
Me.UltraWebGrid1.DisplayLayout.ActiveRow.Delete(False)
End If
Me.UltraWebGrid1.Rows(rowNo).Activate()
End Sub
Am I on the right track now? Any other changes needed.
I still have a problem though when the grouping is in place, the first line of the subroutint LoadDebtor is:
SELECTEDACCOUNT = Me.UltraWebGrid1.DisplayLayout.ActiveRow.Cells(0).Text
I get the dreaded error = ex.Message = "Object reference not set to an instance of an object."
I have tried with your suggestion of using parentcollection but I can't seam to get the correct syntax to do the above, I'm totally lost now.
Hi Trudy,
Are you using UltraWinGrid or UltraWebGrid? If it's UltraWebGrid, as your code here seems to indicate, then you should probably post this question in the ASP.Net forums. I don't really know much about UltraWebGrid, I'm a WinForms guy.
If it is UltraWinGrid, then there are a couple of problems with the code you have here. First, you are using the root-level rows collection of the grid. But if the grid is grouped, then the row being edited won't be in that collection, it will be in a collection of child rows. The easiest way to handle that would be to use the ActiveRow.ParentCollection and work with that collection, rather than grid.Rows.
Another option would be to avoid using indices and instead use the GetSibling method on the row to get the next row. You would have to get the next row and store it in a variable, then delete the active row, then you could activate the row you got.
Thanks for your response, the code in my application is very simple realy, the user activates a line in the grid, when they have finished and wish to work on the next line I simply do this:
Dim lineno As Integer = Me.UltraWebGrid1.DisplayLayout.ActiveRow.IndexMe.UltraWebGrid1.DisplayLayout.ActiveRow.Delete(False)Me.UltraWebGrid1.Rows(lineno).Activate()
It doesn't look as though it can be so easy if the grid has been changed into a collection of groupbyrow though?