Results 1 to 12 of 12

Thread: Application.StartupPath error

  1. #1

    Thread Starter
    Member bestex's Avatar
    Join Date
    Jan 2010
    Posts
    52

    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

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    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,...

  3. #3

    Thread Starter
    Member bestex's Avatar
    Join Date
    Jan 2010
    Posts
    52

    Re: Application.StartupPath error

    i also try that but still got errors, "vshost.exe has stop working " shows when i run the program

  4. #4
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Application.StartupPath error

    Quote Originally Posted by bestex View Post
    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,...

  5. #5

    Thread Starter
    Member bestex's Avatar
    Join Date
    Jan 2010
    Posts
    52

    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

  6. #6
    PowerPoster VBDT's Avatar
    Join Date
    Sep 2005
    Location
    CA - USA
    Posts
    2,922

    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.

  7. #7
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    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,...

  8. #8

    Thread Starter
    Member bestex's Avatar
    Join Date
    Jan 2010
    Posts
    52

    Re: Application.StartupPath error

    cant make application.startuppath to work T_T

  9. #9
    PowerPoster VBDT's Avatar
    Join Date
    Sep 2005
    Location
    CA - USA
    Posts
    2,922

    Re: Application.StartupPath error

    use: My.Application.Info.DirectoryPath

  10. #10

    Thread Starter
    Member bestex's Avatar
    Join Date
    Jan 2010
    Posts
    52

    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")

  11. #11

    Thread Starter
    Member bestex's Avatar
    Join Date
    Jan 2010
    Posts
    52

    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

  12. #12
    Addicted Member
    Join Date
    Nov 2010
    Location
    TamilNadu, India
    Posts
    249

    Re: Application.StartupPath error

    Quote Originally Posted by bestex View Post
    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
  •  



Click Here to Expand Forum to Full Width