Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
VB.NET
VB.NET General Discussion
converting string from a NumericUpDown output to Date
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="matchlock, post: 129151, member: 31959"] hi. i'm a newbie here, and an amateur in programming. i was wondering if you could help me answer my problem with the program that i'm writing. i'm using 3 NumericUpDown controls to get an output and convert it to a Date. i don't know if i am doing this right, and i've been working on this overnight. i'll put the codes that i've written: Private Sub btnDaysOld_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDaysOld.Click Dim shoMonth As Short Dim shoDay As Short Dim shoYear As Short Dim strBirthday As String Dim datBirthday As Date Dim lngDaysOld As Long shoMonth = Convert.ToString(nudBirthMonth.Value) shoDay = Convert.ToString(nudBirthDay.Value) shoYear = Convert.ToString(nudBirthYear.Value) [B]strBirthday = shoMonth.ToString & shoDay.ToString & shoYear.ToString[/B] [B]datBirthday = Date.Parse(strBirthday).ToShortDateString[/B] lngDaysOld = DateDiff(DateInterval.Day, datBirthday, Today) lblDaysOld.Text = lngDaysOld.ToString End Sub i'm trying to get the interval days between the two Dates (the Date today, and my birthday). the bolded texts are the ones that i want to know if i'm doing the right thing. because when i run the program, the error says "Format Exception was unhandled: String was not recognized as a valid DateTime". how can i combine the output from those nud controls to convert it to a string, and then to a Date? i would greatly appreciate your help to solve my problem. Thanks.. [/QUOTE]
Insert quotes…
Verification
Post reply
VB.NET
VB.NET General Discussion
converting string from a NumericUpDown output to Date
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom