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!

Random numbers appearing on the screen of the form

Status
Not open for further replies.

Filip Brnic

Programmer
Dec 25, 2023
42
RS
25_105812522_g4zls0.png
image_2024-06-25_105934787_rxripq.png


Hello, why do random numbers appear on my form when lets say i perform a sum function or something like that? If it means something to you the code where the sum function is, is on the lost focus of a textbox. I dont know what this error is related to, maybe a certain event that makes it so the numbers appear, maybe its just the way visual fox pro works...

you see there is 2 numbers, one cut out and 1 that has Max(vaL(rednibr)
I've sent the codes for both numbers, i mean where the value comes from, idk if that helps...
 
God bless, I've always coppied from the load of my other forms most of the (set) commands, i've noticed in this one that i didn't want results shown on the screen though...
 
Yes, the TALK setting is easy to overlook.

Note that SET TALK is scoped to the data session. So if you start a new data session - typically by launching a form with a DataSession property set to 2 - you will need to repeat the SET TALK (as well as many other SET commands).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Also

Thisform.AllowOutput = .F.

can be important when you print reports, because SET TALK OFF sometimes doesn't work because of an error in VFP.

Regards,
Manni

 
Manni,

I've never heard of SET TALK not working when printing reports. Do you have any further information about the error that you mentioned?

You're not perhaps thinking of the NOCONSOLE clause in the REPORT FORM command?

In any case, Thisform.AllowOutput = .F. wouldn't change that. It simply directs the TALK output to the main screen rather than the current form.

Where I have noticed a problem is in inherited code in Page objects. In one of my apps, I have to explicitly issue SET TLAK OFF in the Init of a Page, even though it is set at the Data Session level. I never found out why.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
The solution is already given and discissed in breadth.

If I take the code you posted in an earlier thread, the source of the "random" numbers are from the CACLCULATE command the code uses.

You can see for yourself when you do a CALCULATE command in the command window, it'll output the result to the _screen (or whatever form is active at the time), even if you use the form of CALCULATE ... TO variable, which directs the result into a variable and thus removes the need to display it, doesn't it? So that's the reason you have such text output at all. A way to avoid this overall is programming the calculations with SQL, instead.

Some calculations, which are actually not really calculations, like CALCULATE MAX(expression) could also simply be done with what you did in your autoiinc solution, that part of your code was okay, you can SET ORDER TO an index in ascending sort order and then GO BOTTOM will put you on the record with the max value, so you can just read it from there. So you already have a solution to avoid using CALCULATE in that case, too.


Chriss
 
Mike, you are right, NOCONSOLE was missing therefore Thisform.AllowOutput = .F. was the solution, so the output was not displayed on the form.

I read somewhere else that SET TALK OFF has a bug and Thisform.AllowOutput = .F. was suggested as a solution. I can't find the thread, unforunately.

Regards,
Manni

EDIT: That's the thread where the bug was mentioned:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top