Ask Your Question
1

How do I initialise a date field in a dialogue or form?

asked 2016-12-28 17:17:51 +0200

ptoye gravatar image

updated 2016-12-28 20:03:24 +0200

Ratslinger gravatar image

I have a dialogue (dialog?) with a date field, and I want to fill in today's date before displaying it. So the macro which is displaying it has code like

  D=Now()
  oDateControl=odialog.GetControl("datDate")
REM This gives a runtime error "Object variable not set"
  oDateControl.Setdate(D)
REM This has no effect on the value of the Date field in the control
  oDateControl.Date.Day=Day(D)
  oDateControl.Date.Month=Month(D)
  oDateCOntrol.Date.Year=Year(D)

But neither of these work for the reasons in the comments. Sorry for the formatting, but the "CODE" button doesn't seem to work properly.

edit retag flag offensive close merge delete

Comments

Edited for clarity. Please use Preformatted Text tool on toolbar for code.

Ratslinger gravatar imageRatslinger ( 2016-12-28 20:04:25 +0200 )edit

I tried to use Preformatted Text and it gave me what you originally saw! Don't know why. Thanks for sorting it out.

ptoye gravatar imageptoye ( 2016-12-28 20:11:14 +0200 )edit

Sometimes you need to add spaces to the beginning of each line. Observe the Preview area before submitting. This will show the actual posting from your input.

Ratslinger gravatar imageRatslinger ( 2016-12-28 20:25:50 +0200 )edit

I did see the preview, but couldn't find a way of getting properly formatted text.

ptoye gravatar imageptoye ( 2016-12-29 12:53:56 +0200 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2016-12-28 21:10:21 +0200

Ratslinger gravatar image

Change: oDateControl.Setdate(D) to oDateControl.View.setText(D).

Here are a couple of posts for reference:

Dialogs & Dates

Clearing Dates

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-12-28 17:17:51 +0200

Seen: 351 times

Last updated: Dec 28 '16