[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 620
  • Last Modified:

how to concatenate strings for Date in VB

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
0
j8547
Asked:
j8547
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
what version of vb?

what is "startdate"?
0
 
sirbountyCommented:
startDate = "01/" & Month(Date) & "/" & Year(Date)
0
 
sirbountyCommented:
oops - from a textbox...
strDate = "01/" & txtBox1.Text & "/" & txtBox2.Text
0
 
mandar_udg80Commented:
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!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now