I have linklabel which has spaces at the end, I want to copy the label's content without the spaces.

This copies the linklbl with spaces at the end:

Clipboard.SetText(E_mailLinkLabel.Text)

But couldn't figure out how to trim the linklabel before copying it.

I was able to figure this out.
Here is the code in case anyone will need this in the future:

'Declares a new variable - string
Dim Email As String
'Assigns the new variable to the text of the exsisting label
Email = E_mailLinkLabel.Text
'Trims the string for spaces
Email = Email.Trim
'Copies the text to clipboard without spaces
Clipboard.SetText(Email.ToString)
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.