-
Feb 20th, 2011, 01:13 AM
#1
Thread Starter
Member
Application.StartupPath error
Hi,
i dont know if my path is correct for my crystal report in vb.net here is my code..
Code:
Imports CrystalDecisions.CrystalReports.Engine
Public Class Form12
Private Sub Form12_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cryRpt As New ReportDocument
cryRpt.Load(Application.StartupPath & "ProductList.rpt")
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
End Sub
End Class
can anyone specify my error? because my project wont work ..
thnx
-
Feb 20th, 2011, 01:15 AM
#2
Re: Application.StartupPath error
Try this:
Code:
Application.StartupPath & "\ProductList.rpt"
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Feb 20th, 2011, 01:21 AM
#3
Thread Starter
Member
Re: Application.StartupPath error
i also try that but still got errors, "vshost.exe has stop working " shows when i run the program
-
Feb 20th, 2011, 01:23 AM
#4
Re: Application.StartupPath error
Originally Posted by bestex
i also try that but still got errors, "vshost.exe has stop working " shows when i run the program
Are you sure that the report file resides in the same location where your EXE file is ?
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Feb 20th, 2011, 01:30 AM
#5
Thread Starter
Member
Re: Application.StartupPath error
yes sir..
because when i use these path it works ..
Code:
cryRpt.Load("C:\Users\bestex\Documents\Visual Studio 2008\Projects\Thesis2\ProductList.rpt")
all i want is to used application.startuppath
-
Feb 20th, 2011, 02:40 AM
#6
Re: Application.StartupPath error
Put a break point on the line "cryRpt.Load(Application.StartupPath & "ProductList.rpt")" and check the "Application.StartupPath & "ProductList.rpt" to see if you get the full qualified file path.
-
Feb 20th, 2011, 02:41 AM
#7
Re: Application.StartupPath error
Code:
Msgbox (Application.StartupPath & "\ProductList.rpt")
Compare the path that you got from the above code and the one you have previously posted.
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Feb 20th, 2011, 03:01 AM
#8
Thread Starter
Member
Re: Application.StartupPath error
cant make application.startuppath to work T_T
-
Feb 20th, 2011, 03:11 AM
#9
Re: Application.StartupPath error
use: My.Application.Info.DirectoryPath
-
Feb 20th, 2011, 03:24 AM
#10
Thread Starter
Member
Re: Application.StartupPath error
it also dont work .. T_T i try these but dont work ..
Code:
cryRpt.Load(My.Application.Info.DirectoryPath & "\ProductList.rpt")
-
Feb 20th, 2011, 03:55 AM
#11
Thread Starter
Member
Re: Application.StartupPath error
haha.. i have fix my code
and i used these code
Code:
cryRpt.Load(Application.StartupPath + "\\..\\..\\" + "ProductList.rpt")
hope it would help you
-
Feb 20th, 2011, 03:58 AM
#12
Addicted Member
Re: Application.StartupPath error
Originally Posted by bestex
yes sir..
because when i use these path it works ..
Code:
cryRpt.Load("C:\Users\bestex\Documents\Visual Studio 2008\Projects\Thesis2\ProductList.rpt")
all i want is to used application.startuppath
check your "Build output path" in compile settings....or post
Clipboard.SetText(Application.StartupPath)...........here
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|