Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I posted a query a short while ago and had an informed answer within a couple of hours. Terrific!..."

Geography

Where in the world do Tek-Tips members come from?

Form not working after building .exe file

ulises48 (TechnicalUser)
12 Apr 12 9:39
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.
danfreeman (Programmer)
12 Apr 12 15:20
Is your view in the form's DataEnvironment?

An empty grid usually means there's no data to display.
ulises48 (TechnicalUser)
13 Apr 12 8:41
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.
OlafDoschke (Programmer)
13 Apr 12 9:05
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.
ulises48 (TechnicalUser)
13 Apr 12 9:25
Thanks Olaf. Could you be more specific about how to do this?
Thank you.
OlafDoschke (Programmer)
13 Apr 12 9:40
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.
TamarGranor (Programmer)
13 Apr 12 16:19
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
danfreeman (Programmer)
13 Apr 12 17:01
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.
ulises48 (TechnicalUser)
13 Apr 12 18:36
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
OlafDoschke (Programmer)
14 Apr 12 5:20
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.
ulises48 (TechnicalUser)
14 Apr 12 6:11
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.
danfreeman (Programmer)
14 Apr 12 12:11

Quote:

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.
ulises48 (TechnicalUser)
17 Apr 12 9:23
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.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close