hello everyone i want to know if there is any way or possible to make msflexgrid to be clickable?like if i want to copy a certain data inside the row of the grid and paste it into notepad or excel..im pulling my hair with this one..need your help..thanks

Trapthe keys "Ctrl" and "C" in their event procedure use

Clipboard.Clear
    Clipboard.SetText Screen.ActiveControl.SelText

Edited 5 Years Ago by faroukmuhammad: n/a

tnx for your help i will try this one, i have found the same to this code but it does not give the ctrl + c function..i will let you know the result thanks again

i got an error on that Screen.ActiveControl.SelText...seems that it doesn't copy.
i tried this code

Clipboard.Clear
    Clipboard.SetText grd.Clip

this code works perfectly but it does not give the ctrl+c function.instead it automatically copy data being selected in the grid

O.k then the problem is from the event proceedure your "copy" code is. Now copy this code and paste in the form containing the grid. Then cut youe copy code and paste if between the IF BLOCK.

Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbkeyctrl And KeyAscii = vbKeyC Then
    Clipboard.Clear
    Clipboard.SetText grd.Clip
    End If
End Sub

The event proceedure traps any key pressed while the form is active, the IF BLOCK tests whether the "Ctlr + C" is pressed. As such when ever you highlight a text on that form and press "Ctrl + C" it copies...

Edited 5 Years Ago by faroukmuhammad: n/a

Corrected Code

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyC Then
        If Shift = 2 Then
             Clipboard.Clear
             Clipboard.SetText grd.Clip
        End If
    End If
End Sub

PS: For this to work set the KeyPreview Property of the your FORM to "True"

Regards
Shaik Akthar

Comments
agree, welcome back.
This question has already been answered. Start a new discussion instead.