Jump to content

Adding Values to Combo Box by reading sections from an InI


Recommended Posts

Okay so here it is, I am trying to update the combo box with the Section names of a ini. What I am needing is the Lastname written as a section name, and then add itself to the combo box. I will be using the combo box to look up informationb by lastname when it is selected.

Any thoughts on this?

notes()
Func notes()
Local $File = @ScriptDir & "Notes.ini"
GUICreate("Notes", 500, 450) ; will create a dialog box that when displayed is centered
GUICtrlCreateLabel("Name", 5, 10, 100, 20)
GUICtrlCreateLabel("Last Name", 110, 10, 100, 20)
GUICtrlCreateLabel("Location", 215, 10, 100, 20)
GUICtrlCreateLabel("Misc", 320, 10, 100, 20)

Local $FirstName = GUICtrlCreateCombo("", 5, 30, 100, 20);Input("", 5, 30, 100, 20)

Local $lastname = GUICtrlCreateInput("", 110, 30, 100, 20)
Local $Location = GUICtrlCreateInput("", 215, 30, 100, 20)
Local $Misc1 = GUICtrlCreateInput("", 320, 30, 100, 20)
Local $Misc2 = GUICtrlCreateInput("", 320, 50, 100, 20)
Local $Misc3 = GUICtrlCreateInput("", 320, 70, 100, 20)
Local $Misc4 = GUICtrlCreateInput("", 320, 90, 100, 20)
Local $Misc5 = GUICtrlCreateInput("", 320, 110, 100, 20)
Local $Misc6 = GUICtrlCreateInput("", 320, 130, 100, 20)
Local $Misc7 = GUICtrlCreateInput("", 320, 150, 100, 20)
Local $Misc8 = GUICtrlCreateInput("", 320, 170, 100, 20)
Local $Misc9 = GUICtrlCreateInput("", 320, 190, 100, 20)
Local $Misc10 = GUICtrlCreateInput("", 320, 210, 100, 20)

Local $Save = GUICtrlCreateButton("Save", 5, 100, 50, 20)
GUISetState(@SW_SHOW) ; will display an empty dialog box
; Run the GUI until the dialog is closed
While 1
  $msg = GUIGetMsg()
  If $msg = $GUI_EVENT_CLOSE Then ExitLoop
  If $msg = $Save Then
   Local $Name = GUICtrlRead($LasttName)
   IniWrite($File, $Name, "Name", GUICtrlRead($FirstName))
   IniWrite($File, $Name, "Location", GUICtrlRead($Location))
   IniWrite($File, $Name, "Misc1", GUICtrlRead($Misc1))
   IniWrite($File, $Name, "Misc2", GUICtrlRead($Misc2))
   IniWrite($File, $Name, "Misc3", GUICtrlRead($Misc3))
   IniWrite($File, $Name, "Misc4", GUICtrlRead($Misc4))
   IniWrite($File, $Name, "Misc5", GUICtrlRead($Misc5))
   IniWrite($File, $Name, "Misc6", GUICtrlRead($Misc6))
   IniWrite($File, $Name, "Misc7", GUICtrlRead($Misc7))
   IniWrite($File, $Name, "Misc8", GUICtrlRead($Misc8))
   IniWrite($File, $Name, "Misc9", GUICtrlRead($Misc9))
   IniWrite($File, $Name, "Misc10", GUICtrlRead($Misc10))
   ExitLoop
  EndIf
WEnd

GUIDelete()
EndFunc   ;==>notes
Edited by cueclub
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...