Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blank Grid at runtime.. 3

Status
Not open for further replies.

ahaws

Programmer
Nov 28, 2001
355
US
Hey guys! I am having a problem with my grid showing a blank white box at runtime.
I built it with the builder and selected 3 fields from a dbf containing 15 fields. So, grid columns count = 3 before runttime.
Also, I am using a pageframe with 3 pgs, and on pg 2 I seek a variable that was entered, and if found, I go to pg 3(where my grid is). I set focus to the grid and eveything...still blank.
Should I set the column count to -1? I think I have heard something like this before but I cant remember...
if anyone knows..please let me know :eek:)
 
When you have a blank grid this usually means that the record source is not correct. Meaning that either the table in the recordsource property is not there or the recordsource property is empty.

HTH,

Weedz (Edward W.F. Veld)
My private project:Download the CrownBase source code !!
 
Hi weedz!
But the RS is the correct table, it is open, and it is not empty...I check upon page activation if it is open....
Strange...>:):O>
 
This may be a scoping problem. How about trying to make this variable you set on page 2 into a form variable so you're sure you can find in on page 3? Dave Dardinger
 
Hey Dave-
I have a form variable...thisform.cSearchvar
and on page 2 I have:


thisform.cSearchvar = alltrim(thisform.pageframe1.add.txtPriv.value)
SET exact off
IF seek(thisform.cSearchvar)
thisform.pageframe1.activepage = 3
ELSE
MESSAGEBOX("There are no privileges like the one you
entered. Please try again",64)
thisform.pageframe1.add.txtPriv.setfocus()
ENDIF
thisform.refresh()

So, when I seek and find, I go to page 3 and behind
thisform.pageframe1.apge3.activate() I have:

with thisform.pageframe1.list.grid2
.refresh()
.setfocus()
endwith
thisform.refresh()


It seems to me that it should be working! X-)
Well... Ill try a few more things and let you know if I get'er done.
thanks
 
Try using the Debugger to create a WATCH on your grid recordsource. You'll need to use the form's FILENAME in doing so. So, for MyForm.SCX, enter this in your Watch window:
Code:
MyForm.Pageframe1.Page3.Grid1.RecordSource
Note that I used the default names for the various controls. If you named them yourself, substitute your names for each.

In any case, when you run the form, switch to the debugger and see what the recordsource says.

Oh...and check the RecordSourceType for the grid, too. What is it set to?
 
hi chpicker-
The RecordSourceType is set to 1-Alias...I'll try this and let you know! Thanks
 
Well, I tracked in the debugger, and all seems like it should work..... The RecordSource is the table that I have bound to the grid, and the RecordSourceType is Alias...

I cant figure this out. This is going to bug me until I fix it %-(
 
Well guys! I did it :p
What I had to do was:
grid.recordsource = ""
before I did the seek, then upon activation of the page that the grid:
grid.recordsource = "Mytable"

voila!
Thanks for all of yall's help!
Angie
 
Just one thing.... for example, if you build your grid with only 3 fields from a .dbf containing 15 fields, when you reassign the recordsource, the grid will populate with all fields.
So, I went out and found a solution from a gal named Barbara Peisch:

In the Grid.Init(), Populate a custom array property with details for each column, then later use that array to rebuild the grid.
First set up a custom property that's an array. It can be on the form, or preferably, on the grid class itself. In the Grid.Init(), DIMENSION the array so it has as many rows as the grid has columns, and as many columns as the number of properties you want to save. At a minimum, you probably want to save ControlSource, CurrentControl, the class of the control, the header caption, the column width, and the column order. Then populate this array with the grid information, as follows:

FOR lnColumnCounter = 1 TO This.ColumnCount
This.aRestore[lnColumnCounter, ] = <first property to store>
This.aRestore[lnColumnCounter,2] = <second property to store>
This.aRestore[lnColumnCounter,3] = <third property to store>
etc.
ENDFOR

You go girl;-)
 
That's very strange. Doing a SEEK shouldn't cause the grid to lose its data...that usually only happens if the grid's data source was closed or requery()'d.

I'm glad you got it, though!
 
Well I did sortof...Now when I click on text1 of the grid, I put code behind the click such as &quot;set step on&quot; to see if the click event works, and it didnt. Then I realized I had the grid set to Readonly = .t...duh! So I changed the readonly = .f. and that didnt do the trick either! I had already posted a &quot;Blank grid problem fixed--another twist..&quot; with a response that I forgot to uncheck readonly....well didnt happen :-(

So now I am trying to find out why my click events on that grid are not working!
Thanks though for your thoughts
Ang
 
My favorite way to determine if an event is firing or not is to throw up a MessageBox such as:
Code:
MessageBox(&quot;Click event&quot;)
 
hey chpicker-
I'll try that and let you know! Thanks;-)
 
Hi ahaws,

Are you using the wizstyle class. If so, check to make sure the grid is also from the wizstyle class. If it is not, there may be a problem with the wizstyle txtbtns cantainer not finding the grid. The txtbtns container has the find, print, first, previous, next, last, add/save, edit/revert, etc buttons to navigate the form. This container has alot of code in the parent and finds all wizstyle objects on the form so they can be refreshed. If the grid is from a vfp foundation class or any class other than wizstyle , it will not be found and refreshed in the wizstyle xtbtns parent code.

Leland F. Jackson, CPA
Software - Master (TM)
Nothing Runs Like the Fox
 
Hi Leland123-

All I did was drag and drop the grid from the standard forms toolbar, then I used the builder to define the recordsource, layout, and which fields that I wanted to be seen. I have used grids in the past and had no difficulty coding behind the click even or keypress event within the text1 cell of the grid(before).

However, since I had the blank grid problem, I had to set grid1.recordsource = &quot;&quot; before my search, and then grid.recordsource = &quot;MyTable&quot;, in the activate() event of the page that contains the grid(should I place this somewhere else????)--then the grid was populated.(*this was the only solution that I 've found that worked for the blank grid problem). I then &quot;set step on&quot; and the found that after the seek the table was never closed, the record pointer was pointing the to the right record, and I know for sure there was not a requery().

It seems that because of those actions, that I might have to redefine &quot;text1&quot; since doing the above I had to reset my controlsources for each column that I wanted to show, along with the widths of the columns and which fields from the dbf I wanted to show, or I would have the entire .dbf(>18 fields) populate my table....

So I am going to try to redefine text1 and see what happens...if any one has a suggestion, please let me know.
Thanks-
Angie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top