>>>I've created a form for prompting different error messages. The form contains a Textbox for different error messages which I want to put for the user.
>>>
>>>How should I run the form and then put the Value of the Error Messages with my choice? Is it possible? For example err..
>>>
>>>errform.txtErrmsg.value = "Record not found."
>>Hi Gan,
>>Joseph and Kenneth already have good suggestions about using textbox and labels. I have another suggestion too :)
>>I would suggest using messagebox(). Because unlike additional forms, messagebox() doesn't cause the form's some events (ie: activate event) fire on return :) Reentrant firing events might be other invitation to errors in some cases (ie: lostfocus of activecontrol fires, your form kicks in, gotfocus of control fires on return, or valid event causes another error in between). To my experience, calling messagebox() is harmless compared to calling a new form :)
>>Cetin
>
>Cetin,
>
>This is a good thing to be know. I don't think it was an issue in VFP 3.0, but in our conversion to VFP 5.0 it has been a problem (workarounds required at times).
>
>Do you (or anyone else reading) know of a way to make a modal form act like a messagebox? In other words, avoid firing LostFocus, Activate, etc. in the calling form...
>
>Joe
Hi Joe,
I tried to make a modal form class acting like a messagebox to no avail. Messageboxes behave as if they are not part of VFP but the system itself. OTOH whatever I tried I couldn't avoid activate of calling form on return (w/o coding something on calling form). At first it wasn't a problem but I hit some situations where it shouldn't occur at all. Think of this :
You have a grid and table has record level validation. At a point you want to present a warning via a form (or a listbox to choose from). Ooops as grid loses focus VFP error mechanism kicks in and complains about "uniquness of index violation", "record level validation" etc. With messagebox there is no problem. As a workaround I fill the needed fields with dummy data and empty them on return or use table buffering vs row buffering. But all in all it beats the "messagebox" form class.
Yet there is another possibility to overcome only a minority of problems. Instead of a new form, new objects could be added and removed just on the calling form. Or mimic the messagebox and build a nonVFP form so it would be task switching vs form switching ? Currently I prefer using messagebox().
Cetin