On Aug 10, 2006, at 3:18 PM, Terry Ford wrote:


On Aug 10, 2006, at 12:14 PM, Robert Poland wrote:

Oops, forgot the subjecy

Subjecy  ?? Typo I guess. ;-)

On Aug 10, 2006, at 11:51 AM, Robert Poland wrote:

Hi,

I have this test project;
The intent is to take a date entered in the editfield and test that it is a Saturday. If it is then enter the long date in the editfield. If it's nat a Saturday then do a msgbox and update the entered date to the full shortdate.

The ultimate goal is to be able to enter the date and when going to the next field validate the date entered.

I has two editfields and one pushbutton;
the following code if entered in the lostfocus field won't run. I entered in the MouseDown of the Pushbutton it works fine.

Why wouldn't you use the action event of the pushbutton?

In the final program I want the date field to be validated as I go on to the next field.

  Dim d As date

That was the example from the book.

You need to instantiate the date object.

Dim d as New Date

  Dim s,t As string= ""
  Dim b As boolean

  s = editfield1.text
  b=parsedate(s,d)
  t=d.longdate

  If InStr(t, "Saturday") = 0 then
    MsgBox "That is not a Saturday"
    t=d.shortdate // strip day off bad day
    editfield1.text=t // update display to complete shortdate
  else
    // was a Sat., update display to a longdate
    t=d.longdate
    editfield1.text=t
  end

Any clue what's wrong?

If you add the New Date to the dim d statement it will sort of work in the lost focus event.

Also why are you bothering with strings at all. The date object has a property called DayOfWeek that you can test directly.

I would also not put it in the LostFocus event of EF1 but put it in the GotFocus event of EF2.

There is no guarantee what the next field will be.

Thanks Terry,

will incorporate your suggestions.

Robert Poland
[EMAIL PROTECTED]



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to