Jump to content
Sign in to follow this  
RagnaroktA

Arrays

Recommended Posts

RagnaroktA

I'm making an array of inputs for an IP address filter, code below.

Dim $ibIPFilter[5]
                                                Dim $ibIPFilter[0] = GUICtrlCreateInput("", 167, 258, 30, 20, $ES_NUMBER)
                                                    GUICtrlSetLimit($ibIPFilter[0], 3, 1)
                                                    GUICtrlCreateLabel (".", 198, 258, 5)
                                                        GUICtrlSetFont (-1, 14, 650)
                                                Dim $ibIPFilter[1] = GUICtrlCreateInput("", 206, 258, 30, 20, $ES_NUMBER)
                                                    GUICtrlSetLimit($ibIPFilter[1], 3, 1)
                                                    GUICtrlCreateLabel (".", 237, 258, 5)
                                                        GUICtrlSetFont (-1, 14, 650)
                                                Dim $ibIPFilter[2] = GUICtrlCreateInput("", 245, 258, 30, 20, $ES_NUMBER)
                                                    GUICtrlSetLimit($ibIPFilter[2], 3, 1)
                                                    GUICtrlCreateLabel (".", 276, 258, 5)
                                                        GUICtrlSetFont (-1, 14, 650)
                                                Dim $ibIPFilter[3] = GUICtrlCreateInput("", 284, 258, 30, 20, $ES_NUMBER)
                                                    GUICtrlSetLimit($ibIPFilter[3], 3, 1)
                                                    GUICtrlCreateLabel ("-", 319, 255, 8)
                                                        GUICtrlSetFont (-1, 14, 650)
                                                Dim $ibIPFilter[4] = GUICtrlCreateInput("", 331, 258, 30, 20, $ES_NUMBER)
                                                    GUICtrlSetLimit($ibIPFilter[4], 3, 1)

When I run the application, it errors on the 'Dim $ibIPFilter[0] = GUICtrlCreateInput(...' line stating: Error: Array variable subscript badly formatted.

What did I miss?


Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki

Share this post


Link to post
Share on other sites
Helge

The first Dim is ok.On the second you're creating the array all over again, and you're

even trying to make it have zero elements. And so on..

Solution : remove the Dim's after the first.

Share this post


Link to post
Share on other sites
big_daddy

There is no need to "re"dim the array each time.

Edit: Helge beat me to it

Edited by big_daddy

Share this post


Link to post
Share on other sites
RagnaroktA

There is no need to "re"dim the array each time.

Edit: Helge beat me to it

Sigh, thanks to both of you. I should've caught that, and I didnt. I appreciate it.


Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki

Share this post


Link to post
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
Sign in to follow this  

×