We help IT Professionals succeed at work.

how to concatenate strings for Date in VB

j8547
j8547 asked
on
Medium Priority
628 Views
Last Modified: 2013-11-25
Looking to have the below but don't know the exact way to put it. where month and year are retrived from txtbox.

startDate = "01/"&month&"/"&year
Comment
Watch Question

Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
what version of vb?

what is "startdate"?
CERTIFIED EXPERT
Top Expert 2007

Commented:
startDate = "01/" & Month(Date) & "/" & Year(Date)
CERTIFIED EXPERT
Top Expert 2007
Commented:
oops - from a textbox...
strDate = "01/" & txtBox1.Text & "/" & txtBox2.Text

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
I assume you are talking about Visual Basic 6.0.

Its straight forward like,-

Dim d1 As Date

d1 = CDate("01" & "/" & txtMonth.Text & "/" & txtYear.Text )

Where txtMonth and txtYear are the assumed names of the textboxes.

Hope it helps!
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.