On Aug 26, 2006, at 10:04 PM, RBNUBE wrote:

The following in the Open event of the window will change the window title:
  Dim d as Date
  d=New Date

  Me.Title = d.shortdate

However, it's not a good idea (if coding cross platform) to use that date
format to name a file because it contains forward slashes.


Something like this might be better:

  Dim d as Date
  Dim theMonth, theDay, theYear as String
  d=New Date

  If d.Month < 10 then
    // Add a leading zero.
    theMonth = "0" + Str(d.Month)
  Else
    theMonth = Str(d.Month)
  End If

  If d.Day < 10 then
    // Add a leading zero.
    theDay = "0" + Str(d.Day)
  Else
    theDay = Str(d.Day)
  End If

// Get the year and move from the right two
// characters to get only the last two characters.
  theYear = Right(Str(d.Year), 2)

  Me.Title = theMonth + theDay + theYear

HTH

Thanks RBNUBE,

Since my app doesn't have a "Window" I was having trouble figuring out where to put the code. Turns out that "Open" under "Event Handlers" was the place. I hadn't gotten to the leading zero thing yet so appreciate that hint. Turned the hew code into a method as I use it three places. All works well.

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