Results 1 to 6 of 6

Thread: [RESOLVED] Weird INI File Error

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2005
    Location
    Toronto, Canada
    Posts
    357

    Resolved [RESOLVED] Weird INI File Error

    I am using a INI file to save the configs of my software. I am getting this weird error when I am saving (writing) the configurations to the INI file.

    I get the following error message:
    Compile Error: ByRef argument type mismatch

    Vb says that the error is with the following line:
    WriteToINI "CLICKWHEEL", "Sensitivity", intSensitivity, strINILoc

    with the intSensitivity part.

    The variable is declared as public and contains either a 1 or 0.
    I have a line before this one that writes a string to the INI file and it works fine, but I get an error with this line.

    I am new to INI files... so any clue??
    Hey... If you found this post helpful please rate it.

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Weird INI File Error

    Post this module "WriteToINI "
    Please mark you thread resolved using the Thread Tools as shown

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2005
    Location
    Toronto, Canada
    Posts
    357

    Re: Weird INI File Error

    Here it is,

    VB Code:
    1. Public Sub WriteToINI(strSectionName As String, strKeyName As String, strValue As String, strFileName As String)
    2.  
    3. Dim WriteToIniResult As Long
    4.  
    5. On Error GoTo ErrHandler
    6.  
    7.     WriteToIniResult = WritePrivateProfileString(strSectionName, strKeyName, strValue, strFileName)
    8.     Exit Sub
    9.    
    10. ErrHandler:
    11.     Debug.Print Err.Description
    12.     Err.Clear
    13.     Resume Next
    14.  
    15. End Sub

    I am off to sleep now, but I will reply tomorrow morning... about 12 hrs later
    Hey... If you found this post helpful please rate it.

  4. #4
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Weird INI File Error

    Try this
    VB Code:
    1. WriteToINI "CLICKWHEEL", "Sensitivity",[B] "intSensitivity", "strINILoc"[/B]
    Please mark you thread resolved using the Thread Tools as shown

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2005
    Location
    Toronto, Canada
    Posts
    357

    Re: Weird INI File Error

    Oops... no that doesn't work... I changed my reply... the second time I tried... it actually wrote down the variable name...

    Umm... intSensitivity is a variable... and strINILoc is a string variable that stores the location of the file... There is nothing wrong with strINILoc... there is something wrong with intSensitivity
    Hey... If you found this post helpful please rate it.

  6. #6
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: [RESOLVED] Weird INI File Error

    Provided this module
    VB Code:
    1. WriteToIniResult = WritePrivateProfileString(strSectionName, strKeyName, strValue, strFileName)
    Please mark you thread resolved using the Thread Tools as shown

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width