Results 1 to 3 of 3

Thread: [RESOLVED] "Can not remove last non-fixed row"

  1. #1

    Thread Starter
    Hyperactive Member shirishdawane's Avatar
    Join Date
    Dec 2004
    Location
    Mumbai,India
    Posts
    363

    Resolved [RESOLVED] "Can not remove last non-fixed row"

    I want to remove selecte row of MsFlexgid. I know the method to do that but suddenly I do not know what happens it gives me error as listed below:
    "Can not remove last non-fixed row" .
    It fires error in both conditions where row = 2 as well as row > 2.
    1st method :
    VB Code:
    1. MSFlexGrid2.RemoveItem (MSFlexGrid1.Row)
    2nd method :
    VB Code:
    1. Dim 1 as Intger
    2. i = MSFlexGrid1.RowSel
    3. MSFlexGrid2.RemoveItem i
    Last edited by shirishdawane; Feb 25th, 2006 at 07:31 AM.
    On Error GoTo http://www.vbforums.com

    Note :
    1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
    2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.

  2. #2
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: "Can not remove last non-fixed row"

    If there is only one normal row left then you can't remove it using .RemoveItem, you'll have to use the .Rows property, something like:

    VB Code:
    1. If MSFlexGrid1.Rows - MSFlexGrid1.FixedRows = 1 Then
    2.   MSFlexGrid1.Rows = MSFlexGrid1.Rows - 1
    3. End If

  3. #3

    Thread Starter
    Hyperactive Member shirishdawane's Avatar
    Join Date
    Dec 2004
    Location
    Mumbai,India
    Posts
    363

    Re: "Can not remove last non-fixed row"

    Thanx bushmobile but I have changed it somthing like this :
    VB Code:
    1. [INDENT]If MSFlexGrid1.Rows - MSFlexGrid1.FixedRows = 1 Then
    2.        MSFlexGrid1.Rows = MSFlexGrid1.Rows - 1
    3. Else
    4.        MSFlexGrid1.RemoveItem (MSFlexGrid1.RowSel)
    5. End If[/INDENT]
    On Error GoTo http://www.vbforums.com

    Note :
    1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
    2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.

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