i have this code that i have written in VB6 and it works ok when i compile and run the program and it compiles ok when make the program into an exe. but when i go to launch the exe. it doesn't work. the error mesage thaty i get is:
arguments are of wrong type, are out of acceptable range, or are in coflict with one another.
I know why this happens, it is because i am trying to read the text from a form from another form:
With cnUser
.Provider = FrmOptions.TxtProvider.Text
.Open FrmOptions.TxtUserPath.Text
the code that i am using to read and write to the ini file is:
Private Sub CmdSaveOptions_Click()
Dim lngRet As Long
Dim lngRets As Long
Dim lngRetss As Long
Dim lngRetsss As Long
Dim strIni As String
Dim strSection As String
Dim strKeyName As String
Dim strKeyValue As String
Dim strInis As String
Dim strKeyNames As String
Dim StrSections As String
Dim StrKeyValues As String
Dim strIniss As String
Dim strKeyNamess As String
Dim StrSectionss As String
Dim StrKeyValuess As String
Dim strInisss As String
Dim strKeyNamesss As String
Dim StrSectionsss As String
Dim StrKeyValuesss As String
strIni = Trim$(txtConfig)
strSection = Trim$(txtSection)
strKeyName = Trim$(txtKeyName)
strKeyValue = Trim$(txtKeyValue)
lngRet = WritePrivateProfileString( _
strSection, _
strKeyName, _
strKeyValue, _
strIni)
strInis = Trim$(txtConfig)
StrSections = Trim$(TxtSections)
strKeyNames = Trim$(txtKeyNames)
StrKeyValues = Trim$(TxtUserPath)
lngRets = WritePrivateProfileString( _
StrSections, _
strKeyNames, _
StrKeyValues, _
strInis)
strIniss = Trim$(txtConfig)
StrSectionss = Trim$(TxtSectionss)
strKeyNamess = Trim$(txtKeyNamess)
StrKeyValuess = Trim$(txtDatabasePath)
lngRetss = WritePrivateProfileString( _
StrSectionss, _
strKeyNamess, _
StrKeyValuess, _
strIniss)
strInisss = Trim$(txtConfig)
StrSectionsss = Trim$(TxtSectionsss)
strKeyNamesss = Trim$(txtKeyNamesss)
StrKeyValuesss = Trim$(TxtProvider)
lngRetsss = WritePrivateProfileString( _
StrSectionsss, _
strKeyNamesss, _
StrKeyValuesss, _
strInisss)
Me.Hide
End Sub
Public Sub Form_Load()
TxtUserPath.Enabled = False
TxtProvider.Enabled = False
txtKeyValue.Enabled = False
txtSection.Enabled = False
txtSection.Visible = False
txtConfig.Enabled = False
txtKeyName.Enabled = False
txtKeyName.Visible = False
txtKeyNames.Visible = False
txtKeyName.Enabled = False
TxtSections.Visible = False
TxtSections.Enabled = False
txtConfigs.Visible = False
txtConfigs.Enabled = False
txtDatabasePath.Enabled = False
txtConfig.Text = App.Path & "\" & App.EXEName & ".ini"
txtSection.Text = "Database"
txtKeyName.Text = "Path"
txtKeyValue = "?:\train\database\"
TxtSections.Text = "Databases"
txtKeyNames.Text = "Path"
TxtUserPath = "H:\??Apps\Letter Composer\"
TxtSectionss.Text = "Databasess"
txtKeyNamess.Text = "Path"
txtDatabasePath = "G:\My Documents\letter composer stuff\?????????????\Letter Composer v2\Options.mdb"
TxtSectionsss.Text = "Provider"
txtKeyNamesss.Text = "Provider"
TxtProvider = "Microsoft.Jet.OLEDB.4.0"
Dim lngRet As Long
Dim lngRets As Long
Dim lngRetss As Long
Dim lngRetsss As Long
Dim strIni As String
Dim strSection As String
Dim strKeyName As String
Dim strKeyValue As String
Dim strInis As String
Dim strKeyNames As String
Dim StrSections As String
Dim StrKeyValues As String
Dim strIniss As String
Dim strKeyNamess As String
Dim StrSectionss As String
Dim StrKeyValuess As String
Dim strInisss As String
Dim strKeyNamesss As String
Dim StrSectionsss As String
Dim StrKeyValuesss As String
strIni = Trim$(txtConfig)
strSection = Trim$(txtSection)
strKeyName = Trim$(txtKeyName)
strKeyValue = Space(255)
lngRet = GetPrivateProfileString( _
strSection, _
strKeyName, _
"", _
strKeyValue, _
Len(strKeyValue), _
strIni)
txtKeyValue = Left$(strKeyValue, lngRet)
strInis = Trim$(txtConfig)
StrSections = Trim$(TxtSections)
strKeyNames = Trim$(txtKeyNames)
StrKeyValues = Space(255)
lngRets = GetPrivateProfileString( _
StrSections, _
strKeyNames, _
"", _
StrKeyValues, _
Len(StrKeyValues), _
strInis)
TxtUserPath = Left$(StrKeyValues, lngRets)
strIniss = Trim$(txtConfig)
StrSectionss = Trim$(TxtSectionss)
strKeyNamess = Trim$(txtKeyNamess)
StrKeyValuess = Space(255)
lngRetss = GetPrivateProfileString( _
StrSectionss, _
strKeyNamess, _
"", _
StrKeyValuess, _
Len(StrKeyValuess), _
strIniss)
txtDatabasePath = Left$(StrKeyValuess, lngRetss)
strInisss = Trim$(txtConfig)
StrSectionsss = Trim$(TxtSectionsss)
strKeyNamesss = Trim$(txtKeyNamesss)
StrKeyValuesss = Space(255)
lngRetsss = GetPrivateProfileString( _
StrSectionsss, _
strKeyNamesss, _
"", _
StrKeyValuesss, _
Len(StrKeyValuesss), _
strInisss)
TxtProvider = Left$(StrKeyValuesss, lngRetsss)
End Sub
is it not working because i am not loading the ini or something. it is weird how it works when i run the program but when i make it into an exe it fails to work please help
thanks