DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Visual Basic 4 / 5 / 6 (http://www.daniweb.com/forums/forum4.html)
-   -   maskedbox (http://www.daniweb.com/forums/thread132738.html)

fa_hed Jul 4th, 2008 5:33 pm
maskedbox
 
I have a form has to (maskedbox1) and (maskedbox2)
if maskedbox1 I put date of today, I want (maskedbox2) show date after 30 days as defult
I will be thank you if you help me to do this
I use vb6

selvaganapathy Jul 4th, 2008 11:31 pm
Re: maskedbox
 
To calculate after 30 days you can use DateAdd() function

Example

Draw two MaskEdit Controls and One Command Button


Private Sub Command1_Click()
  Dim FormatDate As String
  Dim DateAfter30Days  As Date
 
  DateAfter30Days = CDate(MaskEdBox1.Text)
  DateAfter30Days = DateAdd("d", 30, DateAfter30Days)
  FormatDate = Format(DateAfter30Days, "dd/MM/yy")
  MaskEdBox2.Text = FormatDate

End Sub

Private Sub Form_Load()
  MaskEdBox1.Mask = "##/##/##"
  MaskEdBox2.Mask = "##/##/##"
  MaskEdBox1.Text = Format(Date, "dd/MM/yy")
End Sub

Jx_Man Jul 4th, 2008 11:56 pm
Re: maskedbox
 
selvaganapathy was given great code...
also you can try use DateSerial()
DateSerial(Year,Month,Day)
This will add 20 days from 5 July 2008.
Private Sub Form_Load()
MsgBox DateSerial(2008, 7, 5 + 20)
End Sub
Result : 7/25/2008

This will count the 50 days from 1 July 2008.
Private Sub Form_Load()
MsgBox DateSerial(2008, 7, 50)
End Sub
Result : 8/19/2008

fa_hed Jul 5th, 2008 6:10 pm
Re: maskedbox
 
Thank Mr. selvaganapathy
I have another quition:
can I use paper A5 with datereport?

selvaganapathy Jul 5th, 2008 11:11 pm
Re: maskedbox
 
I think, we cannot set paper A5. but you can ReportWidth property. i dont think it will be A5 size.


All times are GMT -4. The time now is 10:58 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC