Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a module

 

Option Strict Off 
Option Explicit On 
Module TXTread 

   Public Function ReadTXTValue(ByRef KEY As String, ByRef Variable As String) As String 
       Dim NF As Short 
       Dim Temp As String 
       Dim LcaseTemp As String 
       Dim ReadyToRead As Boolean 

AssignVariables: 
       NF = FreeFile() 
       ReadTXTValue = "" 
       KEY = "[" & LCase(KEY) & "]" 
       Variable = LCase(Variable) 

EnsureFileExists: 
       FileOpen(NF, frmStart.txtMessage2.Text, OpenMode.Binary) 
       FileClose(NF) 
       SetAttr(frmStart.txtMessage2.Text, FileAttribute.Archive) 

LoadFile: 
       FileOpen(NF, frmStart.txtMessage2.Text, OpenMode.Input) 
       While Not EOF(NF) 
           Temp = LineInput(NF) 
           LcaseTemp = LCase(Temp) 
           If InStr(LcaseTemp, "[") <> 0 Then ReadyToRead = False 
           If LcaseTemp = KEY Then ReadyToRead = True 
           If InStr(LcaseTemp, "[") = 0 And ReadyToRead = True Then 
               If InStr(LcaseTemp, Variable & "=") = 1 Then 
                   ReadTXTValue = Mid(Temp, 1 + Len(Variable & "=")) 
                   FileClose(NF) : Exit Function 
               End If 
           End If 
       End While 
       FileClose(NF) 
   End Function 
End Module  

 

And I put this on my form1

Me.txtCheck4Update.Text = ReadTXTValue("SERVER SET", "HttpAddressFile")

 

And My Setting in the txtMessage2.text is

[sERVER SET]

HttpAddressFile=http://www.something.com/server.txt

 

But when I debug my Application

A Warning Shows up

"ArgumentException was unhandled"

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...