Results 1 to 4 of 4

Thread: [RESOLVED] removing item from mshflexgrid

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2006
    Posts
    74

    Resolved [RESOLVED] removing item from mshflexgrid

    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

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: removing item from mshflexgrid

    Not sure how you do it but there is a method called Removeitem:
    VB Code:
    1. Private Sub Command1_Click()
    2.     With FGrid
    3.         If .Rows > 1 Then 'first row could be the headers
    4.             .RemoveItem .Row 'removes current row
    5.         End If
    6.     End With
    7. End Sub

  3. #3
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: removing item from mshflexgrid

    You can't remove the last non-fixed row with RemoveItem. I use this code

    VB Code:
    1. With FlexGrid
    2.         If .Rows = .FixedRows + 1 Then 'special handling when there is only 1 data row
    3.  
    4.             'if there are headers we hide the first row
    5.             'otherwise headers will also be gone.
    6.             If .FixedRows > 0 Then
    7.                 .RowHeight(1) = 0
    8.             Else
    9.                 .Rows = 0 'this will not generate the error
    10.             End If
    11.         Else
    12.             .RemoveItem lngRow
    13.         End If
    14.     End With

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2006
    Posts
    74

    Re: removing item from mshflexgrid

    thanks guys ................ i found the solution myself as well it is given below

    VB Code:
    1. If MSHFlexGrid1.Rows <= 2 Then
    2.         MSHFlexGrid1.Clear
    3.     Else
    4.         MSHFlexGrid1.RemoveItem (MSHFlexGrid1.Row)
    5.     End If

    anyway your posts are helpful.
    thanks
    anup

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width