Click here to Skip to main content
15,891,674 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Dear all,
in my vb.net form i have open the PDF file click on button, It working but make exe fie it show error. i have also given the code:


VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Process.Start("D:\book.pdf";) 
End Sub
Posted
Updated 8-Mar-13 9:42am
v2
Comments
_Vitor Garcia_ 8-Mar-13 4:05am    
Hi niahant.
Could you please provide details regarding the error you refer ?
Sergey Alexandrovich Kryukov 8-Mar-13 15:56pm    
What "error"? Can you see that it makes no sense at all.
Please see my answer.
—SA
[no name] 8-Mar-13 15:44pm    
Get rid of the semicolon (;) in your code.
DinoRondelly 8-Mar-13 15:46pm    
betting that fixes his problem, +5
[no name] 8-Mar-13 15:49pm    
Thanks. I think so too.

1 solution

VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Process.Start("D:\book.pdf";)
End Sub


Should be
VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Process.Start("D:\book.pdf")
End Sub
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 8-Mar-13 16:16pm    
I voted 4, because my note "there are no cases when using hard-coded file path can be useful" is still valid :-)
And thank you again for spotting my mistake!
Cheers,
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900