Ok, for the last 5 hours Ive been struggling to read from a INI file but still havent gotten anything.
Writing I can do fine, but reading is the problem.
I also wanna know if there are other functions for ini, like Delete or Anything else, other then Get and Write
This is what I have so far:
Import System.IO
Public Declare Function WritePrivateProfileStringA Lib "kernel32.dll" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String) As Long
Public Declare Function GetPrivateProfileStringA Lib "kernel32.dll" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public str_filepath As String
Public str_section As String
Public str_key As String
Public str_target As String
Private Sub btnReadINI_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReadINI.Click
str_filepath = txtPathINI.Text
str_section = txtSectionINI.Text
str_key = txtKeyINI.Text
str_target = txtValueINI.Text
If Not File.Exists(str_filepath) Then
MsgBox("File NOT found!!" & vbNewLine & str_filepath)
Exit Sub
End If
str_key = Space(100)
str_key = Microsoft.VisualBasic.Left(str_key, GetPrivateProfileStringA(str_section, str_key, "", str_target, Len(str_key), str_filepath))
txtValueINI.Text = str_key
End Sub
On the Function declaration, it had variables declared as Any, but the VS didnt recgonized them, marking them with that colored underline, so I put as string.
Please someone help me on this! Ive trying other codes from forums, and even a class lib, but nothing worked...
Do I need to import something especial
Thanks!! :)

Reading from a INI file: How?
BrianD65
>I also wanna know if there are other functions for ini, like Delete or Anything else, other then Get and Write
You delete things with WritePrivateProfileString too, by passing in null (Nothing) arguments. See the Platform SDK docs for details.
P. Weyrosta
Public Declare Function GetPrivateProfileStringA Lib "kernel32.dll" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Integer
Just like that
What about the variables that were declared as Any Ive put string for them..
Im gonna test when I get home, cause Im at work and here there is only VB6.. :(
Tkx for the Help!!