I am bringing in data from SQL that is to be displayed in a multi band ultragrid. This works great. It does what it is supposed to in this regard; however, if I try to select a row other than the first one, in any band of the bands, it freezes the program.
When the grid is loaded, the first row seems to be active (text is bold), so I tried doing an update on the active row. This got rid of the active row, but didn't fix the problem.
Thank you in advance for any help!
Are you using BindingList<> as your data source? Try converting to List<>.If you have to use BindingList<> then set the SyncWithCurrencyManager property on ultragrid to false. This tells the grid not to synchronize the current row with the current position of the CurrencyManager
Related
I'm using the VBA MSHFLEXGRID, 2 grids in fact in the same Form, one below the other so when I choose a row in the first grid, the second one shows info regarding the first grid row selection.
Well, the problem is that the second grid, after choosing a row in the first grid which brings to no information in the second one (I put the data through the own grid recordset, and if i dont want it to show information, i do an exit in the load procedure, it gets crazy and the .ROW property in the Click event starts returning a fixed number, like for example 4, instead of the actual row being clicked. Always a number that represents a higher row than the last one (one that is even out of the grid). I tried also the .MOUSEROW and this one returns 0 all the time (when the grid becomes crazy).
This never happens with the first grid, only with the second one. There's nothing I can do without real information about the row being clicked. I've seen that with different resolutions the problem gets reset. Seems not to happen with low resolutions like 1360x768, but it does with 1920x1080 and 2560x1440.
SOLVED! I was trying cases and more cases to try to understand why it happens sometimes in random cases and finally found it. The problem appears when you set the recordset directly to the grid (Set Grid.Recordset = xxxx) and this xxx is empty. It is, EOF. So I was doing a .Clearstructure, and then the SET. After this, if i did another SET (another selection of the second grid) with a non empty recordset, then it would go crazy.
So what I did was simple assigning first a recordset object to check if the SQL query is empty or not, and if it's not empty and only then, assign the recordset to the grid. Oh my god, this was bringing me crazy after a long time.
VB.Net 4.6.1
Windows Forms application
I have a bound datagridview that I'm trying to sort and select. The data loads fine and I can click the headers (with some code) and the sorting works well. I'm working on reselecting a record after the sort is complete and I'm running into some trouble.
Assume that I have a datagridview with 20 records in it. On the form I also have a button that runs the following:
MessageBox.Show(MyDataGridView.CurrentRow.Index.ToString)
I also have a Sub that handles MyDataGridView.Sorted and in it I have one test line as follows:
MyDataGridView.Rows(2).Selected = True
After the data loads I click on the 11th record (selectionmode fullrowselect) and then I click the button. Box pops up and says "10" (0 based index). I click one of my column headers, the data sorts and the highlight bar jumps up to the 3rd record (index 2). However when I hit my currentrow.index button it still says 10. Additionally if I hit the down arrow key the selection bar jumps down to the 11th (index 10) record in the list.
It seems that using "Selected" doesn't update the currentrow.index value and since it is read-only I can't force it. Can anyone educate me on what's going on because, as it is, my users would be confused if the arrow up and down keys didn't work properly after a sort.
Thank you!
"Current" and "selected" do not mean the same thing. How could they, when multiple rows can be selected but there can only be one current row? The current row is the row that currently contains the caret and a selected row is one that is highlighted. If you want the row at index 2 to be the current row then you need to make a cell in that row the current cell, i.e. assign a cell in that row to the CurrentCell property.
I haven't found exactly what i need in the forums. I don't want to move selection or scroll index, all what I need to is to change the entire row with a specific index to be the last line in my datagridview.
I need this to happen automatically when i edit this row.
P.S. Datagrid is Unbound
for example:
dgv.rows(index).index=dgv.row.getlastrow
However, the debugger return an error that index is read only.
Please help guys!
This worked for me:
Dim curr_row As DataGridViewRow = idgv.Rows(Index)
Dim curr_index As Integer=idgv.Rows.GetLastRow(DataGridViewElementStates.Visible)
idgv.Rows.Remove(curr_row)
idgv.Rows.Insert(curr_index, curr_row)
I am trying to highlight a row of a selected link from an XPage viewPanel. I found this thread >>> http://www-10.lotus.com/ldd/xpagesforum.nsf/xpTopicThread.xsp?documentId=A7133FB0A1AFE05185257A8300429810
I tried it but its failing on the dojo.byId(nodeval). I tried to check the value on that but always returns to null.
Any help/direction would is greatly appreciated.
Thanks very much.
Chay
Dojo.byId() is used to find nodes by id, not nodeval.
I don't think every row has an unique id.
Try using dojo/query.
http://dojotoolkit.org/reference-guide/1.9/dojo/query.html
Can you post your failing code?
I have a form created which an unbound datagridview that has three columns. "Position", "ID", "Name". The data is being added at runtime into a database upon the forms completion. (I don't want to add unnecessary rows to the database in the event a person clicks Cancel.)
What I need to do is on the deletion of a row in the datagridview, search through the rows "Position" for a "HJ" value. If it's not found, change the "Position" value of the first row to be "HJ".
Here's a photo of what I mean:
I've already taken care of the "Add Judge" button. The "Make Head Judge" button I guess will be on another question.
EDIT: Code removed, not needed since I found a function to search through a datagridview for me.
I found information about FirstDisplayedScrollingRowIndex but I can't seem to get it to work for some reason. Any assistance is greatly appreciated.
I would add a hidden column "rank" which could be used to sort the grid. Enumerate each of your ranks: HeadJudge = 0, AsstHeadJudge = 1, Judge = 2. If you will only have one head judge, then sorting by rank will always place the HeadJudge in the first row.