Reply to thread

Hello Guys I Am A Beginner button


I use this code to change value in ini


but i want it to be done by on


its more irritating edit the value and clicking multiple button


i had tried again writing button 1 2 change value but it shows


Error    2    'Private Sub Button1_Click(sender As Object, e As System.EventArgs)' has multiple definitions with identical signatures.    C:\Users\VVLFAMILY\Desktop\WindowsApplication1\WindowsApplication1\Form1.vb    8    17    WindowsApplication1


Imports System.Runtime.InteropServices


Public Class Form1

    <DllImportAttribute("kernel32.dll", EntryPoint:="WritePrivateProfileStringW")> _

    Private Shared Function WritePrivateProfileStringW(<InAttribute(), MarshalAs(UnmanagedType.LPWStr)> ByVal lpSecName As String, <InAttribute(), MarshalAs(UnmanagedType.LPWStr)> ByVal lpKeyName As String, <InAttribute(), MarshalAs(UnmanagedType.LPWStr)> ByVal lpString As String, <InAttribute(), MarshalAs(UnmanagedType.LPWStr)> ByVal lpFileName As String) As <MarshalAs(UnmanagedType.Bool)> Boolean

    End Function


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim IniFileName As String = "C:\TestFolder\MyIniFile.ini"

        Dim SectionName As String = "LastInfo" 'This is Case Sensitive and must match or WritePrivateProfileString will create a new (Section) in the ini file.

        Dim KeyName As String = "SaveName" 'This is Case Sensitive and must match or WritePrivateProfileString will create a new (Key) in the ini file.


        'If Textbox1.text is empty then WritePrivateProfileString will delete the (Key) in the specified (Section) from the file.


        WritePrivateProfileStringW(SectionName, KeyName, TextBox1.Text, IniFileName)

    End Sub

End Class


Continue reading...


Back
Top