Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to check the value in text box
Message
From
04/07/2018 05:50:51
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01660964
Message ID:
01661032
Views:
58
Hi Rick,
Since Dmitry never marks his questions as solved, conversations go on :)

If the code is in a base class, then there would be a need for type checking. I have real world use case for this, the same control could be used with a date, datetime or string depending on the chosen style and the conversion is done behind the scenes as needed. It wouldn't be feasible to create a different class per type to bind.

Also, binding is not a must, without being bound, a textbox could simply be assigned a date value which would make its type date.


>You shouldn't need to use the date check if you make sure the value is bound to a date or datetime value. The value you bind to can be either a cursor or a property on the form.
>
>Then again I think the better way to deal with this is to bind the value to a property or field, and then manipulate the field or property rather than the textbox value. IOW, work on the model not the UI.
>
>+++ Rick ---
>
>>Hi,
>>
>>I have the following code in a KeyPress method
>>
>>
>>this.value = this.value + 1
>>
>>
>>The value is supposed to be a Date. So that the Date in incremented. How do I check that the Value is valid and that it can be incremented by 1 (or whatever).
>>
>>Would the following code be correct?
>>
>>if type('this.value') = 'D'
>>   this.value = this.value + 1
>>endif 
>>
>>
>>Or, maybe vartype() is better. I tested, so far, and both work.
>>
>>TIA
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform