Read INI file...

How can I pass the path of a DB and some parameters from INI file???
guichoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hesCommented:
Here is an example on how to read/write to ini files

http://www.vb-world.net/tips/tip17.html
0
PlinioCommented:
The INIGet and INIPut routines allow you to read and write to INI files. Simply cut and paste the following
                code.

                Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal
                lpapplicationname As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString
                As String, ByVal nSize As Long, ByVal lpFileName As String) As Long

                Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal
                lpapplicationname As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As
                String) As Long

                Public Function INIGet(Keyfilename, Keyarea, Keyname, Keydefault) As String
                Dim a As String
                Dim b As String
                Dim C As String
                Dim D As String
                Dim E As String
                Dim ReturnValue As Long
                a = Keyarea
                b = Keyname
                C = Keydefault
                D = Space$(144)
                E = Keyfilename
                ReturnValue = GetPrivateProfileString(ByVal a, ByVal b, ByVal C, ByVal D, Len(D), ByVal E)
                INIGet = Left$(D, ReturnValue)
                End Function

                Public Sub INIPut(Keyfilename, Keyarea, Keyname, ByVal Keyvalue As String)
                Dim a As String
                Dim b As String
                Dim C As String
                Dim D As String
                Dim ReturnValue As Long
                a = Keyarea
                b = Keyname
                C = Keyvalue
                D = Keyfilename
                ReturnValue = WritePrivateProfileString(ByVal a, ByVal b, ByVal C, ByVal D)
                End Sub
0
guichoAuthor Commented:
When I try to run the application appear this error message:

Compile error:

Constants, fixed-length, arrays, and Declare statements not allowed as Public members of object modules.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

paulstampCommented:
Using the procedures above... put them into a module, not a form. That ought to sort it out.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
guichoAuthor Commented:
Adjusted points to 60
0
guichoAuthor Commented:
Thanks for the tip...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.