Results 1 to 4 of 4

Thread: [RESOLVED] multiple selections in mshflexgrid

  1. #1

    Thread Starter
    Frenzied Member litlewiki's Avatar
    Join Date
    Dec 2005
    Location
    Zeta Reticuli Distro:Ubuntu Fiesty
    Posts
    1,162

    Resolved [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________(___)____
    __(___)_________) _/_____
    ___\_ (_________(_/______
    ____\_)_________________

  2. #2

    Thread Starter
    Frenzied Member litlewiki's Avatar
    Join Date
    Dec 2005
    Location
    Zeta Reticuli Distro:Ubuntu Fiesty
    Posts
    1,162

    Re: multiple selections in mshflexgrid

    so is it solvable or is there no workaround .suggestions ,ideas, advices plz
    __________________
    ________________0îîî___
    ___îîî0________(___)____
    __(___)_________) _/_____
    ___\_ (_________(_/______
    ____\_)_________________

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

    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:
    1. Dim aTemp() As String
    2. Dim lngRow As Long
    3. Dim lngCol As Long
    4.  
    5. With MSFlexGrid1
    6.     'set the number of rows and cols
    7.     .Rows = 10
    8.     .Cols = 5
    9.     'add some sample data  
    10.     For lngRow = 1 To .Rows - 1
    11.         For lngCol = 1 To .Cols - 1
    12.             .TextMatrix(lngRow, lngCol) = "Row " & lngRow & " : Col " & lngCol
    13.         Next
    14.     Next
    15.    
    16.  
    17.     'set the range of selected cells
    18.     .Row = 1
    19.     .Col = 1
    20.     .RowSel = 3
    21.     .ColSel = 2
    22.  
    23.     'populate the array.
    24.     ReDim aTemp(.RowSel - .Row, .ColSel - .Col)
    25.    
    26.     For lngRow = .Row To .RowSel
    27.         For lngCol = .Col To .ColSel
    28.             aTemp(lngRow - .Row, lngCol - .Col) = .TextMatrix(lngRow, lngCol)
    29.         Next
    30.     Next
    31.    
    32. 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.

  4. #4

    Thread Starter
    Frenzied Member litlewiki's Avatar
    Join Date
    Dec 2005
    Location
    Zeta Reticuli Distro:Ubuntu Fiesty
    Posts
    1,162

    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
  •  



Click Here to Expand Forum to Full Width