I want to delete data from mshflexgrid but if there is only one data then mshflexgrid shows error in deleting can anyone help me by telling me how to remove data from flexgrid if there is only one record
thanks anup
Printable View
I want to delete data from mshflexgrid but if there is only one data then mshflexgrid shows error in deleting can anyone help me by telling me how to remove data from flexgrid if there is only one record
thanks anup
Not sure how you do it but there is a method called Removeitem:
VB Code:
Private Sub Command1_Click() With FGrid If .Rows > 1 Then 'first row could be the headers .RemoveItem .Row 'removes current row End If End With End Sub
You can't remove the last non-fixed row with RemoveItem. I use this code
VB Code:
With FlexGrid If .Rows = .FixedRows + 1 Then 'special handling when there is only 1 data row 'if there are headers we hide the first row 'otherwise headers will also be gone. If .FixedRows > 0 Then .RowHeight(1) = 0 Else .Rows = 0 'this will not generate the error End If Else .RemoveItem lngRow End If End With
thanks guys ................ i found the solution myself as well it is given below
VB Code:
If MSHFlexGrid1.Rows <= 2 Then MSHFlexGrid1.Clear Else MSHFlexGrid1.RemoveItem (MSHFlexGrid1.Row) End If
anyway your posts are helpful.
thanks
anup