Hi,
I've recently start a new job and my employer is using iGrid ActiveX 5.00.0089 (I've also tested today using the 5.00.0090 demo version and it has the same issues), and I've come across a few issues I can't figure out how to resolve. The applications are being developed in Visual Basic 6 SP6 on Windows 7.
The first is where the control selects all rows when repopulating. This appears to be due to rebuilding the grid data while a cell is being edited. Create a new application with a single form, add the control as iGrid1 and a command button as Command1, and in the form paste the following code:
Option Explicit
Private Sub Command1_Click()
With iGrid1
.Clear
.RowCount = 3
.CellValue(1, 1) = "test1"
.CellValue(2, 1) = "test2"
.CellValue(3, 1) = "test3"
End With
End Sub
Private Sub Form_Load()
iGrid1.AddCol "Test"
End Sub
Start up the application, click the command button. Click on any cell and press the Del key, which clears the cell. Then press the command button again - all the cells are highlighted grey as the grid doesn't have focus, when any cell is clicked all of them are highlighted in blue. It doesn't matter how many time the grid is rebuilt using Command1, all rows will be highlighted, and will need to be clicked twice each to clear the highlights, although they all get highlighted again when the command button is clicked whether a cell is in edit mode or not. Adding a ClearSelection method call doesn't do anything either.
The other issue is a much bigger problem. I require every cell to have a value unless it is the last row, in a single column grid. Add the following code to the above example:
Private Sub iGrid1_CellSelectionChange(ByVal lRow As Long, ByVal lCol As Long, ByVal bSelected As Boolean)
'has selection moved away from an empty cell?
If lRow > 0 And lCol > 0 And bSelected = False Then
With iGrid1
If .CellValue(lRow, lCol) = "" And lRow < .RowCount Then
'delete this row, cell is empty
.RemoveRow lRow
End If
End With
End If
End Sub
Start up the application, select a row and press the Del key which clears it. Then move to another cell, using either the mouse or the up/down cursor keys. The application will crash, and is full reproducible.
Any help with these would be appreciated.
Regards,
Dan
Edited by moderator
2014-07-18T07:05:28Z
|
Reason: Using code blocks