1 Replies - 348 Views - Last Post: 03 November 2017 - 07:48 AM Rate Topic: -----

#1 jjstccean  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 03-November 17

Formatting date in VB.NET

Posted 03 November 2017 - 07:45 AM

I'm new to VB.net coming from MS-Access and need help with this problem: I'm keeping a list of people phoning me and I'm hoping to generate a "CallNumber" with text coming from a FirstName And LastName respectively. I'm faced with a CAST DATE problems - any assistance will be greatly appreciated. Thank you.

THIS IS HOW I've DONE IT IN ACCESS.

Private Sub LastName_Exit(Cancel As Integer)
If Me.LastName = "" Then
Exit Sub


Else

Me.ClientNo.SetFocus
Me.ClientNo = Left(Me.FirstName, 1) & Left(Me.LastName, 1) & Format(Me.ContactDate, "ddmmyyyy")
Me.BusAddress.SetFocus
End If
End Sub



VB.NET
Private Sub dtPhoned_Leave(sender As Object, e As EventArgs) Handles dtPhoned.Leave
Dim nameF As String = txtFirstName.Text
Dim nameL As String = txtLastName.Text
txtCallNumber.Text = Microsoft.VisualBasic.Left(nameF, 1) + Microsoft.VisualBasic.Left(nameL, 1) + dtPhoned.ToString("ddmmyyyy")
End Sub



Is This A Good Question/Topic? 0
  • +

Replies To: Formatting date in VB.NET

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13489
  • View blog
  • Posts: 53,886
  • Joined: 12-June 08

Re: Formatting date in VB.NET

Posted 03 November 2017 - 07:48 AM

What is the problem?

If you are getting error messages please copy/paste the text here.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1