|
-
Apr 14th, 2006, 04:00 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] multiple selections in mshflexgrid
i have been using this mshflexgrid and its pretty nice to work with ,i am able to work comfortably with it except that i cant make multiple selections i.e i want the user to be able to select one or more rows at a time and then i will store the corresponding col values in an array and work with it.
iam currently using this code to selct the column value of the selected row
Code:
msfg1.TextMatrix(msfg1.Row, 3)
thanks in advance
__________________
________________0îîî___
___îîî0________(___)____
__(___)_________) _/_____
___\_ (_________(_/______
____\_)_________________
-
Apr 15th, 2006, 03:54 PM
#2
Thread Starter
Frenzied Member
Re: multiple selections in mshflexgrid
so is it solvable or is there no workaround .suggestions ,ideas, advices plz
__________________
________________0îîî___
___îîî0________(___)____
__(___)_________) _/_____
___\_ (_________(_/______
____\_)_________________
-
Apr 15th, 2006, 08:18 PM
#3
Re: multiple selections in mshflexgrid
The FlexGrid does not support "Extended Selection", i.e. a user cannot select rows/cols 1, 3, 5, 7. They can only select contiguous rows/cols as in 1,2,3,4. "Extended Selection" can be easily simulated in code if that is what you need.
The Row and Col properties indicate the start of the selected cells. The RowSel and ColSel properties indicate the end of the selected cells.
For example, the following will select Columns 1 and 2 of Rows 1, 2 and 3. Then it will loop through the selected range and populate an array
VB Code:
Dim aTemp() As String
Dim lngRow As Long
Dim lngCol As Long
With MSFlexGrid1
'set the number of rows and cols
.Rows = 10
.Cols = 5
'add some sample data
For lngRow = 1 To .Rows - 1
For lngCol = 1 To .Cols - 1
.TextMatrix(lngRow, lngCol) = "Row " & lngRow & " : Col " & lngCol
Next
Next
'set the range of selected cells
.Row = 1
.Col = 1
.RowSel = 3
.ColSel = 2
'populate the array.
ReDim aTemp(.RowSel - .Row, .ColSel - .Col)
For lngRow = .Row To .RowSel
For lngCol = .Col To .ColSel
aTemp(lngRow - .Row, lngCol - .Col) = .TextMatrix(lngRow, lngCol)
Next
Next
End With
Note that RowSel and ColSel could be less than Row and Col, so you will need to adjust the code to allow for that possibility.
-
Apr 16th, 2006, 05:18 PM
#4
Thread Starter
Frenzied Member
Re: multiple selections in mshflexgrid
alright this thing works thanks a lot brucevde ,
and yes i was actually looking for the extended thing ,how do we do that ??
in excel we hold down the ctrl key and select rows ,how can that be done here?
__________________
________________0îîî___
___îîî0________(___)____
__(___)_________) _/_____
___\_ (_________(_/______
____\_)_________________
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
|