{"name":"lbAdd","title":"lbAdd","type":"command","url":"https://community.bistudio.com/wiki/lbAdd","revid":379428,"updated":"2026-10-31T00:05:13Z","groups":["GUI Control - ListBox"],"status":"ok","games":{"ofp":"1.75","ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofp 1.75","arma3_since":"0.50","locality":{"argument":"local","effect":"local"},"description":"Adds an item with the given text to the CT_LISTBOX or CT_COMBO or CT_TOOLBOX.\n\n> [!NOTE]\n> If using `RscToolBox` as template with ctrlCreate, clear it first with lbClear","syntaxes":[{"syntax":"lbAdd [idc, text]","params":[{"name":"idc","type":"Number","description":"control IDC","type_expr":"Number"},{"name":"text","type":"String","description":"visible text","type_expr":"String"}],"returns":{"type":"Number","type_expr":"Number","description":"index (row) of newly added item"},"form":"unary","right":{"text":"[idc, text]"}},{"syntax":"control lbAdd text","params":[{"name":"control","type":"Control","type_expr":"Control"},{"name":"text","type":"String","type_expr":"String"}],"returns":{"type":"Number","type_expr":"Number","description":"index (row) of newly added item"},"form":"binary","left":{"text":"control"},"right":{"text":"text"}}],"examples":[{"code":["_index = lbAdd [101, \"First item\"];"]},{"code":["_index = _control lbAdd \"First item\";"]}],"see_also":["lbDelete","lbText"],"notes":[{"user":"ffur2007slx2_5","date":"2014-09-10T00:00:00Z","text":"More information on the CT_LISTBOX command family can be found here."},{"user":"Nelis75733126","date":"2015-04-12T11:01:00Z","text":"This command can be very very frustrating to use because it does not output any errors if unable to function.\nOften, the 2nd provided syntax needs to be used like this:\n\n```sqf\n_giveYourControlAname = findDisplay 7 displayCtrl 9;\n_addThisToListBox = \"Option\";\n_giveYourControlAname lbAdd _addThisToListBox;\n```\n\nWhere \"7\" is the \"idd\" of the dialog you made in your \".hpp\" file and where \"9\" is the \"idc\" of the RscListBox or RscComboBox.\nThe code above will add an option named \"Option\" to the ListBox or ComboBox."}]}