PDA

Click to See Complete Forum and Search --> : DBGrid Issues


fdcusa
Jan 3rd, 2011, 02:28 AM
I've inherited a VB6 app written in 2000, and am more a VBA coder than VB...

I have registered the DBGRID32.OCX successfully. When running the app, it stops at "DBGrid1.SetFocus" with Error 424, Object required. When I attempt to re-type the line, I notice that there is no intellisense dropdown after I type "dbgrid1.". I have looked all over and don't see a "DBGrid?" control on the form.

I apologize for asking what may be a very simple question to answer. Any help would be most appreciated.

John

honeybee
Jan 3rd, 2011, 02:35 AM
Most likely the control named DBGrid1 does not exist on the form. Try setting a breakpoint at the SetFocus line and check if DBGrid1 does indeed point to an existing control.

If I remember correctly, if the DBGrid control wasn't registered and if you opened the app in VB6 code editor and tried to view the form, the DBGrid control would most likely be removed from the form (as it wasn't registered). If you then saved it, you would essentially be saving the form sans the control.

A solution would be to add it back, however you need to test the code thoroughly to ensure the control properties are set to the correct values.

.

fdcusa
Jan 3rd, 2011, 03:05 AM
Ah, when I look at another form, I do see a DBGrid1 control. I looked back at the original code and it also does not have a dbgrid control on the errant form! I added a DBGrid1 control. When I attempt to add another, it wants to create it as an array. But the code is calling dbgrid1, dbgrid2, dbgrid3, dbgrid4 - instead of dbgrid(index).

Edit: Okay, getting somewhere - added a datagrid control, renamed to dbgrid4, then 3, then 2, and finally 1. Now, to get the table headers like I see on the other form...
Edit: Found Datasource property, set to Data1 which I see in the code. I now get data on the 1st "tab", but it doesn't change for the other 3...

I think I'm getting there, and I THANK YOU for the nudge in the right direction!

Good News! I got all 4 to working, now to fix the navigation bar at the bottom. Man, someone really messed this thing up bad. The code was all mixed up. I'm not even sure if this functionality even worked at all before. I'll find out when I next talk to the person who asked me to look at it.

Thanks again for the nudge! :)