Previously I was using this code to add only Images to the application (GIFs doesn't work):
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles BtnImgBrowse.Click
Dim t As New OpenFileDialog
t.Filter = "*.JPG;*.PNG;*.GIF|*.JPG;*.PNG;*.GIF"
If t.ShowDialog = DialogResult.OK Then
TxtImgFile.Text = t.FileName
Clipboard.SetImage(Image.FromFile(TxtImgFile.Text))
End If
End Sub
Now I want to add PDfs, Documents and Excel file also, So I changed my code little bit, but it doesn't seem to work:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles BtnImgBrowse.Click
Dim t As New OpenFileDialog
t.Filter = "*.JPG;*.PNG;*.GIF;*.DOC;*.DOCX;*.XLS;*.XLSX;*.PDF|*.JPG;*.PNG;*.GIF;*.DOC;*.DOCX;*.XLS;*.XLSX;*.PDF"
If t.ShowDialog = DialogResult.OK Then
TxtImgFile.Text = t.FileName
Clipboard.ContainsData(TxtImgFile.Text)
End If
End Sub
It just copies the Data from my system. Not the file that I select within the application.