Jump to content

List and Combo get items


APPLEEATER
 Share

Recommended Posts

Hello

I've got this problem

i need to get the items from an listbox and a combo box

the controls are both in my gui (if that matters)

i need them sent to an array

it it works if it is sent to a string separated by a character too

I have tried GUICtrlRead() and ControlGetText()

But these only return the selected one

Thanks alot for any help :P

Link to comment
Share on other sites

Now my problem is different :S

This code:

$temp = StringSplit(GUICtrlRead($CitemsE), ",")
$tmax = _ArrayMaxIndex($temp) + 1
_GUICtrlListBox_ResetContent($Cindex[$Cindx])
For $i = 1 To $tmax
    _GUICtrlListBox_AddString($Cindex[$Cindx], $temp[$i])
Next

Does not always work??

My example string is 1,2,3,4,5,6,7

And the listbox only has 1 item in it "1"

The other one is 1,2

and that is the same

then i tried 7,3

and that worked just fine!

what is wrong with this?

Edit:

Tried something new and it works:

$temp = StringSplit(GUICtrlRead($CitemsE), ",")
_GUICtrlListBox_ResetContent($Cindex[$Cindx])
For $i = 1 To $temp[0]
    _GUICtrlListBox_AddString($Cindex[$Cindx], $temp[$i])
Next

I'd still like to know what the difference is for the future?

Edited by APPLEEATER
Link to comment
Share on other sites

Now my problem is different :S

This code:

$temp = StringSplit(GUICtrlRead($CitemsE), ",")
$tmax = _ArrayMaxIndex($temp) + 1
_GUICtrlListBox_ResetContent($Cindex[$Cindx])
For $i = 1 To $tmax
    _GUICtrlListBox_AddString($Cindex[$Cindx], $temp[$i])
Next

Does not always work??

My example string is 1,2,3,4,5,6,7

And the listbox only has 1 item in it "1"

The other one is 1,2

and that is the same

then i tried 7,3

and that worked just fine!

what is wrong with this?

Edit:

Tried something new and it works:

$temp = StringSplit(GUICtrlRead($CitemsE), ",")
_GUICtrlListBox_ResetContent($Cindex[$Cindx])
For $i = 1 To $temp[0]
    _GUICtrlListBox_AddString($Cindex[$Cindx], $temp[$i])
Next

I'd still like to know what the difference is for the future?

_ArrayMaxIndex() returns the index of the greatest item, not the last item. Use the UBound() function to get the size of an array.
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
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...