I'm new here and I am looking for a bit of help with a project I am working on. It is complete except for one function. I need help with coding a button to select and copy text in VB6. I have never done anything like this before and I have not been able to find any answers anywhere else.
Here is the code I have so far

Private Sub cmaCopy_Click()
    Clipboard.Clear
    Clipboard.SetText txtResults.SelText
End Sub

It only works after the text has been selected and I cannot find a reference to make it preselect then copy.

Any help I can get will be greatly appreciated.

Well... I have finally found a solution to my problem...

Well... I have finally found a solution to my problem...

Private Sub Command1_Click()
    txtResults.SelStart = 0
    txtResults.SelLength = Len(txtResults.Text)
    Clipboard.Clear
    Clipboard.SetText txtResults.SelText
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.