Reading multiple data strings from INI file

I have a problem reading multiple data from an INI file. I can read one no problem but I keep getting an Error13 if I try to read more than one. Any Help would be appreciated. The code I use in the form to read the single ini data is as follows:

Dim m_oReadINI As CReadINI
Dim sLocation As String

On Error GoTo Eh_FormLoad

Set m_oReadINI = New CReadINI

'set location of the INI file
sLocation = "C:HomeSettings.ini"

'pass info from CReadINI

With m_oReadINI
.ININame = "C:HomeSettings.ini"
.Section = "Settings"
.Key = "RobotID"
txtRobotID.Text = .ReadINISettings
End With

Set m_oReadINI = Nothing
Exit Sub

Eh_FormLoad: ' If no INI file present or errors in INI file then alarm message appears.
Dim sMsg As String
sMsg = "Error Number: " & Err.Number & vbCrLf & _
"Error Description: " & Err.Description
MsgBox sMsg, vbCritical, "frmMain.FormLoad"
Resume Exit_FormLoad

I want to be able to read multiple data from different keys etc from this code. How do I do this??

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!