Jump to content

array problem


Zithen
 Share

Recommended Posts

I looked at a few forum posts but havnt seen what i am doing wrong....i know its probly a simple typo that i am bypassing....here is the code..this is the error

ubscript used with non-Array variable.:

$name[$i] = GUICtrlCreateCheckbox($name[$i],10,$y,200,10)

$name[$i] = GUICtrlCreateCheckbox($name^ ERROR

lots of locals just just because i was trying everythign i could think of

Func deltest()
    Local $name
    Local $check[20]
    Local $delini
    Local $x = 10
    Local $y = 20
    Local $i[100]
    
    
    $name = IniReadSectionNames($file)
    If @error Then
        MsgBox(48, "Error", "Error: Can not read save file." & @CR & @CR & "Error: 1084")
    Else
        GuiCreate("Delete Printers", 400, 230)
            For $i = 1 To $name[0]
                $name = IniRead($file, $name[$i], "name", "null")
                $name[$i] = GUICtrlCreateCheckbox($name[$i],10,$y,200,10)
                $y = $y + 20
            Next
        $DelLbl = GuiCtrlCreateLabel("Please check the printers you would like to delete.", 80, 10, 250, 20)
        $DelBtnAll = GuiCtrlCreateButton("Delete All", 100, 190, 70, 30)
        $DelBtnGo = GuiCtrlCreateButton("Begin", 210, 190, 70, 30)
    EndIf


;$Checkbox_2 = GuiCtrlCreateCheckbox("Checkbox2", 10, 40, 200, 10)
;$Checkbox_3 = GuiCtrlCreateCheckbox("Checkbox3", 10, 60, 200, 10)

    GuiSetState()
    While 1
        $msg = GuiGetMsg()
        Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case Else
        ;;;
        EndSelect
    WEnd
    Exit
EndFunc
Link to comment
Share on other sites

This looks like it might be a problem:

$name = IniRead($file, $name[$i], "name", "null")

$name[$i] = GUICtrlCreateCheckbox($name[$i],10,$y,200,10)

The first line kills the array and assigns a single value to the $name variable. The next line tries to handle it as if it's still an array, which fails and creates the error message you're seeing.

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...