Thanks! I think I've got it working now, and I'll post the code for anybody
else who might be looking for the solution later.
I was somewhat concerned about calling an addObject line in every Form_load,
since as I understand that routine is run every time you switch to the form, so
I stole a bit of the flag logic used by the form builder autogenerated code. I
started with:
Dim gridLoaded
gridLoaded = 0
and in the form_load routine:
Sub Display_Load()
if gridLoaded = 0 then
AddObject "GridCtrl.GridCtrl.1", "Grid", 4, 4, 220,
144, Display_Form
gridLoaded = 1
end if
Everything's running fine now - a little bit slow, but that might be because I
haven't added indexes to the sqlite db yet.
Thank you very much, George!
--- In [email protected], "George Henne" <gh@...> wrote:
>
> The grid is probably there, but behind your forms. To add the grid to a
> form, add its name to the end of the line, as you did in one of your
> tries. The best place to add the grid is in the Form_load routine for
> the form you want it on. It gets called after the form has been created.
>
> >Okay, I've tried searching for this, but can't find an answer that works
> >for me. I'm updating an old project with four forms, and one of them has
> >a grid. When I run it with the default form designer code, I get a
> >message like this when I try to work with the grid:
> >
> >Scripting Error: [ok]
> >Microsoft VBScript runtime error - line 265, char 4
> >Variable is undefined: 'Grid'
> >
> >This is when the auto-generated Display_Show routine for the 'Display'
> >form containing the grid uses the following line:
> >
> > NSExecute "AddObject " & chr(34) & "GridCtrl.GridCtrl.1" & chr(34)
> >& ", " & chr(34) & "Grid" & chr(34) & ", 4, 4, 220, 144, Display_Form"
> >
> >As far as I can tell from experimenting with the 'GridHowToLite' sample
> >project in the Files section, this syntax will work when the form with
> >the grid on it is the startup form, otherwise it fails to add the grid
> >and generates the 'variable is undefined' message.
> >
> >Under the heading of 'So crazy it just might work', I tried rewriting
> >this as an ordinary AddObject line, the same way as the other Display
> >form objects that load happily:
> >
> > AddObject "GridCtrl.GridCtrl.1", "Grid", 4, 4, 220, 144, Display_Form
> >
> >This had no better results.
> >
> >Finally, based on a message I found here on the group, I tried adding
> >the grid from the very start of the program, at the same time as I add
> >my SQLite connection:
> >
> >AddObject "GridCtrl.GridCtrl.1", "Grid", 900, 900, 220, 144
> >
> >In the Display_Load routine, I entered these line to move the Grid on-screen:
> > Grid.Move 4, 4
> > Grid.show
> >
> >with the following lines in Display_Hide:
> > Grid.move 900, 900
> >
> >The result of this was half a loaf - no more error messages, but I still
> >didn't see the grid on my pocket PC.
> >
> >So, can anybody help with this? What's the right way to put a grid on a
> >form-designer form? All of the grid examples that I've found, aside from
> >GridHowToLite, seem to be using the model of adding all objects manually.
> >
> >
> >
> >------------------------------------
> >
> >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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nsb-ce?hl=en.