<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Cannot find file issue in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/cannot-find-file-issue/m-p/6933488#M32400</link>
    <description>&lt;P&gt;Excellent response guys, I started work on this yesterday...and got to this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        'READ TBM_conf.ini FILE TO POPULATE THE MAJORITY OF INTERNAL VARIABLES FOR PROCESSING
Try
        'Dim All_Lines() As List(Of String)
        'Dim ConfigFile As New IO.StreamReader("TBMconf.ini")
        'Dim OriginalString As String
        'OriginalString = ConfigFile.ReadLine
        'Do Until String.IsNullOrEmpty(OriginalString)
        'Loop
        'ConfigFile.Close()
....&lt;/PRE&gt;&lt;P&gt;Which caused AutoCAD to hang, and after a few attempts at changing things AutoCAD just refused to open at all, with a Fatal Error message...Had to use the install disc to repair it, so lost a fair bit of time...but we're up and running again and I commented the offending section out till I've got a better method for populating my GUI textboxes. It was ok whist it couldn't find the file, but as soon as I sorted that (miss spelt filename), it died on me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Really appreciate your replies and will come back to it when I've sorted myself out. I can see where it would go into a permanent loop now, as I write this, (the Do Loop is after the 'read' )but after losing my CAD yesterday, all code went out the window whilst the 'main prog' was fixed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Les&lt;/P&gt;</description>
    <pubDate>Thu, 09 Mar 2017 10:06:13 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-03-09T10:06:13Z</dc:date>
    <item>
      <title>Cannot find file issue</title>
      <link>https://forums.autodesk.com/t5/net-forum/cannot-find-file-issue/m-p/6929897#M32396</link>
      <description>&lt;P&gt;Hi people,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ok, so I have my DLL working fine, but have decided to use an *.ini txt file to preload past configuration settings and defaults from.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the *.ini file in the same folder as the DLL but get an error message saying it cant be found!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        'READ TBM_conf.ini FILE TO POPULATE THE MAJORITY OF INTERNAL VARIABLES FOR PROCESSING

        Dim All_Lines As New List(Of String)
        Dim ConfigFile As New IO.StreamReader("TBMconfig.ini")
        Dim OriginalString As String
        OriginalString = ConfigFile.ReadLine
        Do Until String.IsNullOrEmpty(OriginalString)
        Loop
        ConfigFile.Close()&lt;/PRE&gt;&lt;P&gt;Any thoughts chaps...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Les&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2017 13:44:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/cannot-find-file-issue/m-p/6929897#M32396</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-08T13:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot find file issue</title>
      <link>https://forums.autodesk.com/t5/net-forum/cannot-find-file-issue/m-p/6930067#M32397</link>
      <description>&lt;P&gt;IMO, you should code your app to find the data file in a predefined searching logic, such as the same folder as the DLL is in, the user's Windows profile data location, and so on. In your case, if you decide the data file must be in the same folder as the DLL is, you can text its existence before using it. Something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Private Function FindConfigurationFile() As String&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Dim asm As Assembly=Assembly.GetExecutingAssembly()&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Dim filePath=asm.Location &amp;amp; "\TBMconfig.ini"&lt;/P&gt;
&lt;P&gt;&amp;nbsp; If Not File.Exists(filePath) Then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; ''Search other places, if necessary, or throw exception&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Throw New FileNotFoundException("Cannot find configuration file!")&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Else&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Return filePath&lt;/P&gt;
&lt;P&gt;&amp;nbsp; End If&lt;/P&gt;
&lt;P&gt;End Function&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2017 14:23:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/cannot-find-file-issue/m-p/6930067#M32397</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2017-03-08T14:23:50Z</dc:date>
    </item>
    <item>
      <title>Re : Cannot find file issue</title>
      <link>https://forums.autodesk.com/t5/net-forum/cannot-find-file-issue/m-p/6930070#M32398</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try like this (not sure about VB syntax)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Imports System.IO
'...

'READ TBM_conf.ini FILE TO POPULATE THE MAJORITY OF INTERNAL VARIABLES FOR PROCESSING

Dim assemblyPath As String = System.Reflection.Assembly.GetExecutingAssembly().Location
Dim configFilePath As String = Path.Combine(Path.GetDirectoryName(assemblyPath), "TBMconfig.ini")
Dim All_Lines As New List(Of String)
Dim ConfigFile As New StreamReader(configFilePath)
Dim OriginalString As String
OriginalString = ConfigFile.ReadLine
Do Until String.IsNullOrEmpty(OriginalString)
Loop
ConfigFile.Close()&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Mar 2017 14:24:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/cannot-find-file-issue/m-p/6930070#M32398</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2017-03-08T14:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot find file issue</title>
      <link>https://forums.autodesk.com/t5/net-forum/cannot-find-file-issue/m-p/6930176#M32399</link>
      <description>&lt;P&gt;you can also use an embedded resource&amp;nbsp;&lt;A href="https://support.microsoft.com/en-ca/help/319292/how-to-embed-and-access-resources-by-using-visual-c" target="_self"&gt;&amp;gt;&amp;gt;here&amp;lt;&amp;lt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2017 14:45:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/cannot-find-file-issue/m-p/6930176#M32399</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2017-03-08T14:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot find file issue</title>
      <link>https://forums.autodesk.com/t5/net-forum/cannot-find-file-issue/m-p/6933488#M32400</link>
      <description>&lt;P&gt;Excellent response guys, I started work on this yesterday...and got to this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        'READ TBM_conf.ini FILE TO POPULATE THE MAJORITY OF INTERNAL VARIABLES FOR PROCESSING
Try
        'Dim All_Lines() As List(Of String)
        'Dim ConfigFile As New IO.StreamReader("TBMconf.ini")
        'Dim OriginalString As String
        'OriginalString = ConfigFile.ReadLine
        'Do Until String.IsNullOrEmpty(OriginalString)
        'Loop
        'ConfigFile.Close()
....&lt;/PRE&gt;&lt;P&gt;Which caused AutoCAD to hang, and after a few attempts at changing things AutoCAD just refused to open at all, with a Fatal Error message...Had to use the install disc to repair it, so lost a fair bit of time...but we're up and running again and I commented the offending section out till I've got a better method for populating my GUI textboxes. It was ok whist it couldn't find the file, but as soon as I sorted that (miss spelt filename), it died on me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Really appreciate your replies and will come back to it when I've sorted myself out. I can see where it would go into a permanent loop now, as I write this, (the Do Loop is after the 'read' )but after losing my CAD yesterday, all code went out the window whilst the 'main prog' was fixed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Les&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2017 10:06:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/cannot-find-file-issue/m-p/6933488#M32400</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-09T10:06:13Z</dc:date>
    </item>
  </channel>
</rss>

