Results 1 to 5 of 5

Thread: file path

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2007
    Posts
    694

    file path

    I have developed a windows application which uses a class library project.
    Inside the class libraray project, I have added a file i.e. test.xml
    How can I refer to this file from within the class library project?
    p.s. This is a correction to my previous post...
    Thanks

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: file path

    where is test.xml located?
    you could use something like:

    vb Code:
    1. my.application.info.directorypath

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2007
    Posts
    694

    Re: file path

    Hi,
    As mentioned before, the xml file is in the class library project.
    What you suggested does not seem to work inside class libraray class.
    Thanks

  4. #4
    PowerPoster Deepak Sakpal's Avatar
    Join Date
    Mar 2002
    Location
    Mumbai, India
    Posts
    2,424

    Re: file path

    vb.net Code:
    1. Public Class Class1
    2.  
    3.     Public Function GetLibraryPath() As String
    4.         Dim libraryPath As String = Me.GetType.Assembly.FullName
    5.         Return libraryPath
    6.     End Function
    7.  
    8. End Class
    As you can see I written a public function GetLibraryPath in class library and called it from windows application. This works.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2007
    Posts
    694

    Re: file path

    Correction to my previous post.

    I have created a windows application.
    There are forms inside the windows form application project. There is a class library project too.

    The .sln is in the following path:
    C:\Work\Developments\SQLchecks\SQLchecks

    The windows forms are inside the windows application project as below:
    C:\Work\Developments\SQLchecks\SQLchecks\SQLchecks

    There is a class library project called DataAccess which has classes and an xml file called Settings.xml :
    C:\Work\Developments\SQLchecks\SQLchecks\DataAccess

    Question:
    from within a class inside the DataAccess project which is a class library project, how do I refer to the Settings.xml file which is also in the same directory?

    Thanks

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