Today's code (from Mark H) may come as a bit of surprise to you. After all, we're so used to seeing only the best quality work from those who bill more per hour than most take home in a day, especially when they use VB6 as a platform. For some bizarre reason, this nearly flawless recipe for success didn't quite work out so well. In addition to writing his own INI-reading functionality, the highly-paid consultant found a rather unique way of reading through lines in a file ...
Public Sub SetConfiguration() Dim sLineData As String On Error GoTo ErrorHandler Open App.Path + "\appconfig.ini" For Input As #1 While True Input #1, sLineData If UCase(Mid(sLineData, 1, 8)) = "[CONFIG]" Then Input #1, sLineData sSysDir = Mid(sLineData, 8) 'ED: Snip Input #1, sLineData UserName = Mid(sLineData, 8) Input #1, sLineData Password = Mid(sLineData, 9) End If Wend Close #1 Exit Sub ErrorHandler: If Err.Number = 62 Then 'ED: Error 62 is "Input past End Of File" Exit Sub Else WriteToLog Date & " - " & Err.Number & ", " & Err.Description & " - GetGlobals routine." End If End Sub
[Advertisement]
BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!