Results 1 to 25 of 25

Thread: RESOLVED Read from *.ini file

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    154

    Resolved RESOLVED Read from *.ini file

    Hey All,

    Well I can't figure this out...

    I have my program reading some info from an ini file on startup. If you
    manually start it...it reads the info just fine. But, if you have the program,
    auto start with windows, it will not read the ini file at all! Here's the code
    I'm using...

    VB Code:
    1. Private Const NUMOFTXTBOXES = 7
    2.  
    3. Public Function LoadINIFile()
    4.     Dim strArray(0 To NUMOFTXTBOXES - 1) As String
    5.     Dim i As Long
    6.     Dim FileHandle%
    7.     Dim strFileName As String
    8.     Dim SourceFile As String
    9.    
    10.     If Right$(App.path, 1) = "\" Then
    11.        SourceFile = App.path
    12.     Else
    13.        SourceFile = App.path & "\"
    14.     End If
    15.    
    16.     strFileName = SourceFile & "myfile.ini"
    17.  
    18.     FileHandle% = FreeFile
    19.     i = 0
    20.  
    21.     Open strFileName For Input As #FileHandle%
    22.     Do While Not EOF(FileHandle%)
    23.        Line Input #FileHandle%, strArray(i)
    24.        i = i + 1
    25.     Loop
    26.  
    27.     Label1.Caption = strArray(0)
    28.     Label2.Caption = strArray(1)
    29.     Label3.Caption = strArray(2)
    30.     Label4.Caption = strArray(3)
    31.     Label5.Caption = strArray(4)
    32.     Label6.Caption = strArray(5)
    33.     Label7.Caption = strArray(6)
    34.  
    35.     Close FileHandle%
    36.     DoEvents
    37. End Function

    Any Ideas?

    Thanks in advance,
    Ron
    Last edited by rdcody; Oct 12th, 2005 at 05:37 PM.

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