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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form not working after building .exe file

Status
Not open for further replies.

ulises48

Technical User
Feb 3, 2012
17
MX
Hello all. I have a form with 2 grids. One of them is based on a view. The form works ok when I run it while in designing mode, but as soon as I build my app into an .exe file, the form shows an empty grid. What am I missing?
Thank you in advance.
 
Is your view in the form's DataEnvironment?

An empty grid usually means there's no data to display.
 
danfreeman: yes it is. The weird thing is that the form works OK when I open it in the regular working/designing environment. As soon as I build the app in an .exe file, the view based grid starts out empty. I know there is data because other forms using similar data show it OK. Thanks for your answer.
 
You should debug what the difference is at runtime.

First: In Grid init() check whether the view displayed is open, via USED("viewname"). This should be .T.

Bye, Olaf.
 
Thanks Olaf. Could you be more specific about how to do this?
Thank you.
 
In the form designer double click on the grid. The code editor will open in some Grid method. Most probably Init. If the procedure combobox in the editor header area displays some other method or event name, choose Init from there.

Now that your editor is showing the grid init, most probably empty, add this code there:
Code:
If Used("viewname")
   Messagebox("view is open")
Else
   Messagebox("view is not open")
EndIf
* also perhaps see what Grid Recordsource is at this moment:
Messagebox("Grid Recordsource:",This.Recordsource)

Of course change "viewname" to the appropriate name.

You could repeat that in the Form.Init, too. There you need to change This.Recordsource to This.Grid1.Recordsource, but everything else can be reused.

Bye, Olaf.
 
When you say the grid is empty, do you mean there's no data in in, or do you mean there's nothing at all in it, no columns, no headers, no nothin'?

Tamar
 
I wondered about that too, Tamar.

If there's "no nothin'" in it, I'd check to see if something in the form's init (or the grid's or another control's) that closes and reopens the view, deconstructing the grid.

If the form "works in design environment" but not in an EXE, then you need to figure out what's different in the exe. I can think of lots of ways to *cause* this behavior, but don't have enough information to debug it.
 
There is the grid with the columns and headers. Just no data in it. I will try Olaf's advise tomorrow when I'm at my working computer.
Wll post the results later.
Thank you all
 
If that's the case you most probable get the answer the view is opened. It's just empty. Look out for setting parameters and if the DE views are set to load no data, you need to Requery() once.

But all that would also apply to running the form in the VFP IDE.

Puzzeling.

Bye, Olaf.
 
I am starting to think that my problem may come from my MAIN.PRG.
So far this is the only difference I can see between running the form directly from the project manager (it works) or from my MENU form (does not work) which runs from my MAIN.PRG when executing the compiled .exe file. I don't have access to my work computer at the moment, but will post my MAIN.PRG later. Thanks again, guys.
 
But all that would also apply to running the form in the VFP IDE.

Yeah, unless you've been fiddling with the view and it already has data when you run in the IDE ... yadda, yadda, yadda

Could also be a difference in, f'rinstance, SET EXACT between runtime and IDE causing a view parameter to be evaluated differently. Could be "lucky data" in test data while the exe uses "real" data.

Like I said, there are tons of ways to cause this behavior if I *wanted* to. But each of them has dependencies of their own and it's hard to know where to go with such scant information.
 
Well this is weird. I put the code in the grid's init()as Olaf said, and everything went fine in the IDE. I compiled the code and ran the
.exe and everything went fine. It worked! I did not modify anything else but the init parameter. I set the init to default (blank) and now my form works OK after compiling. (shrugs). No idea what happened.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top