MSFlexGrid select/copy to clipboard? 
Author Message
 MSFlexGrid select/copy to clipboard?

I'm a VB nubie/rookie.

I have a small app I'm playing with that's using a MSFlexGrid control
with 3 columns and up to 50 rows.  I'd like to put data in it from my
application, then let the user select all or part of it and "copy" it
into the clipboard for use somewhere else.  However it looks to me
like the "copy" part isn't supported in this control.  I have some
other ideas on how to display the data but I thought I'd ask about
MSFlexGrid first.  Am I missing something about this control?



Tue, 04 Sep 2001 03:00:00 GMT  
 MSFlexGrid select/copy to clipboard?
I have an msflexgrid called grid. There is a menu item to copy the grid
selection to the clipboard.

Private Sub mnuPrintGrid_Click()
Dim fn As Integer, i As Integer, j As Integer
fn = FreeFile
Open "C:\omgrid.txt" For Output As fn
For i = 0 To Grid.Rows - 1
    Grid.Row = i
    For j = 1 To Grid.Cols - 1
    Grid.Col = j
    Print #fn, Grid.Text & Chr(9),
    Next j
    Print #fn,
Next i
Close
rBox.fileName = "C:\omgrid.txt"
End Sub
Private Sub mnuPrintGridSel_Click()
 Dim s As String, cRow As Integer, cCol As Integer
 Dim rSel As Integer, cSel As Integer

 cRow = Grid.Row
 cCol = Grid.Col
 rSel = Grid.RowSel
 cSel = Grid.ColSel
 Grid.Redraw = False
   s = printGrid(Grid)
 Grid.Row = cRow
 Grid.Col = cCol
Grid.RowSel = rSel
 Grid.ColSel = cSel
 Grid.Redraw = True
   rBox.Text = s
   Clipboard.Clear
   Clipboard.SetText s
End Sub
Private Function printGrid(Grid As MSFlexGrid) As String
Dim startRow As Integer, endRow As Integer, startCol As Integer, endCol
As Integer
Dim i As Integer, j As Integer, s As String
Call startRowCol(Grid, True, startRow, endRow)
Call startRowCol(Grid, False, startCol, endCol)
Grid.Row = 0 'get the headings
For j = startCol To endCol
        Grid.Col = j
        If Grid.ColWidth(j) > 25 Then
            s = s & Grid.Text & Chr(9)
        End If
Next j
    s = s & vbCrLf
For i = startRow To endRow
    Grid.Row = i
    For j = startCol To endCol
        Grid.Col = j
        If Grid.ColWidth(j) > 25 Then
            s = s & Grid.Text & Chr(9)
        End If
    Next j
    s = s & vbCrLf
Next i
printGrid = s
End Function
Private Sub startRowCol(Grid As MSFlexGrid, Row As Boolean, ByRef start,
ByRef finish)
    If Row Then
        If Grid.Row < Grid.RowSel Then
            start = Grid.Row
            finish = Grid.RowSel
        Else
            start = Grid.RowSel
            finish = Grid.Row
        End If
    Else
        If Grid.Col < Grid.ColSel Then
            start = Grid.Col
            finish = Grid.ColSel
        Else
            start = Grid.ColSel
            finish = Grid.Col
        End If
    End If
End Sub

Quote:

> I'm a VB nubie/rookie.

> I have a small app I'm playing with that's using a MSFlexGrid control
> with 3 columns and up to 50 rows.  I'd like to put data in it from my
> application, then let the user select all or part of it and "copy" it
> into the clipboard for use somewhere else.  However it looks to me
> like the "copy" part isn't supported in this control.  I have some
> other ideas on how to display the data but I thought I'd ask about
> MSFlexGrid first.  Am I missing something about this control?



Sun, 09 Sep 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Copying DBGrid contents to clipboard (Or copying a table from a Data component to clipboard)

2. Copy a MsFlexGrid selection into the Clipboard

3. How to copy to clipboard from MSFlexGrid control?

4. Copy to clipboard form msflexgrid

5. Copy Selection from MSFlexGrid to Clipboard

6. Copy To Clipboard using MSFlexGrid

7. Select All and Copy to clipboard web page with VBScript

8. Copy selected content in MSHFlexGrid to clipboard

9. MSFlexGrid to Clipboard HELP - Please.

10. COPY AND PASTE FROM GLOBAL CLIPBOARD IN VBA

11. Copy a part of a textbox to clipboard

12. copy to clipboard(form)

 

 
Powered by phpBB® Forum Software