qiangqiang101 Posted November 2, 2012 Posted November 2, 2012 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" Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.