Hi George, I made this simpler program this morning. It repeats the same functionality, but without all the background stuff going on, with the same result. Just attach it to a form with a single command button. If I change the NSExecute in _Load to an executeglobal, the redim in the _Click works, but the msgbox in _Load doesn't happen.
CurrentForm = "Provenience" ShowOKButton True Sub Form1_Load nsexecute "dim " & CurrentForm & "(4)" MsgBox UBound(Eval(CurrentForm)) End Sub Sub CommandButton1_Click nsexecute "redim " & CurrentForm & "(8)" MsgBox UBound(Eval(CurrentForm)) End Sub Any idea? --- In nsbasic...@yahoogroups.com, "George Henne" <g...@...> wrote: > > You might try testing this with a simpler program to see what is going > on. You should also try Execute and ExecuteGlobal, which have different > (and poorly documented) scoping rules. > > >Hi All, > > > >I'm creating arrays based on my form names on the fly using NSExecute. > >Form names are read from a text file, so they're not known until run- > >time. For example, I have form named "Provenience" so I create a array > >to store that data named Provenience. The size of the array is based on > >the number of controls that save data to files. So if there are 4 > >controls on the form, the code that does this is: > > > >NSExecute "dim " & CurrentForm & "(" & UBound(ControlsToWrite) & ")" > > > >where CurrentForm = "Provenience" and ControlsToWrite is an array of 4 > >control names (Ubound returning 3). > > > >This works great with no errors. The problem is in certain cases, I > >need to expand this array to hold data not stored in a control (it's > >being tracked internal to the app). I have used NSExecute with "Redim > >preserve" before (including in this app), but for some reason it does > >not want to cooperate in this specific case: > > > >NSExecute "Redim preserve " & CurrentForm & "(" & UBound(ControlsToWrite) > >+1 & ")" > > > >I've tried even hardcoding this with no luck: > > > >Redim preserve Provenience(5) > > > >No matter which way I try, I get a VBScript failure - line x, char 6 > >(just past Redim?) with no other information. > > > >Any ideas? I'm totally stuck as to why this won't allow me to do it. > > > >Thanks, > >Shaun > > > > > > > >------------------------------------ > > > >Yahoo! Groups Links > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nsb-ce" group. To post to this group, send email to nsb-ce@googlegroups.com To unsubscribe from this group, send email to nsb-ce+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nsb-ce?hl=en -~----------~----~----~----~------~----~------~--~---