473,491 Members | 2,247 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

reading from ini

3 New Member
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
Sep 12 '06 #1
1 2108
steve0
3 New Member
it's alright i sorted it
Sep 13 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
3563
by: Andy | last post by:
Hi, In the code below (not pretty I know but it's an early version :-P) I'm having problems reading the data object back in. If I move the reading code to immediately after the section where it...
6
2377
by: Raymond Hettinger | last post by:
Found in a pamphlet at a pre-school: --------------------------------------- Reading improves vocabulary Reading raises cultural literacy through shared knowledge Reading develops writing skills...
4
3035
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # to open a file and write to file # do f=open('xfile.txt','w') # this creates a file "object" and name it f. # the second argument of open can be
24
2712
by: Hendrik Schober | last post by:
Hi, I have a 'std::istream' and need to read its whole contents into a string. How can I do this? TIA; Schobi
19
10266
by: Lionel B | last post by:
Greetings, I need to read (unformatted text) from stdin up to EOF into a char buffer; of course I cannot allocate my buffer until I know how much text is available, and I do not know how much...
4
9804
by: Oliver Knoll | last post by:
According to my ANSI book, tmpfile() creates a file with wb+ mode (that is just writing, right?). How would one reopen it for reading? I got the following (which works): FILE *tmpFile =...
6
3742
by: KevinD | last post by:
assumption: I am new to C and old to COBOL I have been reading a lot (self teaching) but something is not sinking in with respect to reading a simple file - one record at a time. Using C, I am...
3
9492
by: Nick | last post by:
I have found a class that compresses and uncompresses data but need some help with how to use part of it below is the deflate method which compresses the string that I pass in, this works OK. At...
9
5482
by: Mike Reed | last post by:
I must be having a "senile" day! I cannot recall, nor get to work, code to read a cookie's expiration date/time in an ASP page/VBScript. What am I missing? *** Sent via Developersdex...
4
3239
by: Gaijinco | last post by:
I had a file named nap.in which looks like this: 4 10:00 12:00 Lectures 12:00 13:00 Lunch, like always. 13:00 15:00 Boring lectures... 15:30 17:45 Reading 4 10:00 12:00 Lectures 12:00 13:00...
0
7115
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6978
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7154
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7190
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6858
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7360
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4881
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4578
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1392
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.