How to write .ini Format from a Flexgrid in VB6

201 Views Asked by At

What i want : to a make a button that exports the selected data in this FelxGrid into .ini file format take (heights) as section and the others as values and keys , it dosen't have to be ini format it can also be something close to it

What i tried so far

Private Sub commandbutton_1()

Dim configfile As String
Dim myArray() As String 'i tried using arry but it didn't work 

configfile = "C:\" & "\CONFIGMEEE!.INI"


PutINISetting "", "", SettingsGrid.Clip, configfile


MsgBox "Exported.", vbInformation, "Settings"

SettingsGrid.SaveGrid configfile, flexFileTabText

What happened then the data we exported but not formatted at all as ini and written so :

enter image description here

Important to know

The flexgrid iam using is a vsflexgrid not an msflexgrid

And i am also using this as a MOUDLE

'API Function to write information to the INI File

Private 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

'Get the INI Setting from the File
Public Function GetINISetting(ByVal sHeading As String, _
    ByVal sKey As String, _
    sINIFileName) As String

    Const cparmLen = 50
    Dim sReturn As String * cparmLen
    Dim sDefault As String * cparmLen
    Dim lLength As Long
    lLength = GetPrivateProfileString(sHeading, _
            sKey, _
            sDefault, _
            sReturn, _
            cparmLen, _
            sINIFileName)

    GetINISetting = Mid(sReturn, 1, lLength)
End Function

'Save INI Setting in the File
Public Function PutINISetting(ByVal sHeading As String, _
    ByVal sKey As String, _
    ByVal sSetting As String, _
    sINIFileName) As Boolean

    Const cparmLen = 50
    Dim sReturn As String * cparmLen
    Dim sDefault As String * cparmLen
    Dim aLength As Long
    aLength = WritePrivateProfileString(sHeading, _
        sKey, _
        sSetting, _
        sINIFileName)

    PutINISetting = True
End Function
0

There are 0 best solutions below