|
-
Jul 27th, 2006, 01:50 PM
#1
Thread Starter
Registered User
[RESOLVED] MSFlexGrid Delete All Selected Rows
Hi,
I would like to know how to delete all the selected rows from an MSFlexGrid contol. What I have now will only delete the last selected row. Anyone know how to do this?
Thanks!
-
Jul 27th, 2006, 03:06 PM
#2
Re: MSFlexGrid Delete All Selected Rows
 Originally Posted by jseal
... What I have now will only delete the last selected row...
So, what do you have so far?
-
Jul 27th, 2006, 03:11 PM
#3
Fanatic Member
Re: MSFlexGrid Delete All Selected Rows
If the code is similar to a Listbox do the following.
Sorry I don't know anything about MSFlexGrid Control =\
VB Code:
Private Sub Command2_Click()
Dim Inc As Integer ' or long
For Inc = List1.ListCount - 1 To 0 Step -1
If List1.Selected = True Then
List1.RemoveItem
End If
Next Inc
End Sub
Please RATE posts, click the RATE button to the left under the Users Name.
Once your thread has been answered, Please use the Thread Tools and select RESOLVED so everyone knows your question has been answered.
"As I look past the light, I see the world I wished tonight, never the less, sleep has come, and death shall soon follow..." © 1998 Jeremy J Swartwood
-
Jul 27th, 2006, 03:13 PM
#4
Re: MSFlexGrid Delete All Selected Rows
 Originally Posted by rack
...Sorry I don't know anything about MSFlexGrid Control ...
Then you shouldn't reply at all. Sorry.
-
Jul 27th, 2006, 05:34 PM
#5
Re: MSFlexGrid Delete All Selected Rows
VB Code:
Private Sub RemoveSelection()
Dim i As Long, lStartSel As Long, lEndSel As Long
With MSFlexGrid1
If .RowSel >= .Row Then
'its a Top -> Down selection
lStartSel = .Row
lEndSel = .RowSel
Else
'its a Down -> Top selection
lStartSel = .RowSel
lEndSel = .Row
End If
For i = lEndSel To lStartSel Step -1
.RemoveItem i
Next
End With
End Sub
Last edited by jcis; Jul 27th, 2006 at 11:24 PM.
-
Jul 27th, 2006, 10:19 PM
#6
Fanatic Member
Re: MSFlexGrid Delete All Selected Rows
 Originally Posted by RhinoBull
Then you shouldn't reply at all. Sorry.
Looks like I had the correct idea per post number 4. Just never used it before.
What is wrong with giving ideas and help? I am not telling him to draw pixels on the screen, or read from a file. I am telling him how to create the correct type of loop. The answer could be ignored, and at the very least, it could trigger a thought in the person who knows more about that type of control.
I would never post anything anti-productive. I felt it had relevance. I read a lot of posts that I do not post to, because I do not user that contorl, or understand a specific control.
Please RATE posts, click the RATE button to the left under the Users Name.
Once your thread has been answered, Please use the Thread Tools and select RESOLVED so everyone knows your question has been answered.
"As I look past the light, I see the world I wished tonight, never the less, sleep has come, and death shall soon follow..." © 1998 Jeremy J Swartwood
-
Jul 28th, 2006, 09:50 AM
#7
Thread Starter
Registered User
Re: MSFlexGrid Delete All Selected Rows
Thanks jcis, it works great!
-
Jul 28th, 2006, 10:19 AM
#8
Re: MSFlexGrid Delete All Selected Rows
 Originally Posted by rack
...What is wrong with giving ideas and help?...
Nothing really. The problem however is that vast majority expects presise answers and idea of comparing Listbox with the FlexGrid may (and I'm sure will) create tons of confusion so best way would be not to reply if you aren't sure. Was your idea relevant? Besides the loop it really wasn't.
That's all.
Best regards.
-
Jul 28th, 2006, 03:12 PM
#9
Fanatic Member
Re: [RESOLVED] MSFlexGrid Delete All Selected Rows
I guess your right =) Sorry, Was in a bad mood yesterday from work, didn't mean to sound rude in my responce =).
Please RATE posts, click the RATE button to the left under the Users Name.
Once your thread has been answered, Please use the Thread Tools and select RESOLVED so everyone knows your question has been answered.
"As I look past the light, I see the world I wished tonight, never the less, sleep has come, and death shall soon follow..." © 1998 Jeremy J Swartwood
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|