By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,943 Members | 1,890 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,943 IT Pros & Developers. It's quick & easy.

NumericUpDown Control

P: 2
hi
I am studying vb by distance learning n i do need all the help i can get. i am to develop a program to be used as a student data base. One of the required information is an input for student Date of birth from which the program will then calculate the age of the student.
If used 3 numericUpDown Controls for this. one eacc for the day, month and year. the problem i am facing is that i cant get the dates to appear in the format
say 12/11/2007 in a label i placed underneath the numericUpDown control. what can i do about this please???????????????
Apr 29 '07 #1
Share this Question
Share on Google+
3 Replies


Expert 5K+
P: 8,434
Do you mean that you want the three values to be combined into a date, and then displayed in a single label? Or is there a separate label beneath each UpDown control?

Can you show us what you've attempted so far along these lines?
Apr 29 '07 #2

P: 2
Do you mean that you want the three values to be combined into a date, and then displayed in a single label? Or is there a separate label beneath each UpDown control?

Can you show us what you've attempted so far along these lines?

yeah! i am tryn to get the three values combined into date format in a label i named LblBirthDate.
what i have looks like this
LblBirthDate.Text = Str(nudDay.Value) + Str(nudMonth.Value) + Str(nudYear.Value)
This way i only get something lookn like this 1 11 1995 with no "/" separating the day from month and month from year.

ps bn new at this, is there any book you would recommend for a complete novice like myself. i really need to get ma act together on this.
Apr 30 '07 #3

Expert 5K+
P: 8,434
yeah! i am tryn to get the three values combined into date format in a label i named LblBirthDate.
what i have looks like this
LblBirthDate.Text = Str(nudDay.Value) + Str(nudMonth.Value) + Str(nudYear.Value)
This way i only get something lookn like this 1 11 1995 with no "/" separating the day from month and month from year.

ps bn new at this, is there any book you would recommend for a complete novice like myself. i really need to get ma act together on this.
When you are concatenating the three strings, you just need to include another two strings between them. That is, the slashes ("/"). In fact, I would recommend the following changes...
  • Drop the Str() functions. Pretty sure they're unnecessary. Actually, since Str() leaves a space, you might have to change to the Format() function.
  • Use & rather than + to concatenate the values into the string. The plus sign can be misinterpreted as a numeric addition. Hm... which might explain why you have the STR() functions there, I suppose.
  • Consider the possibility of replacing all this with a datepicker control. This gives you a date field, which can pop up a calendar to allow the user to select a date. Depending on the circumstances, it can be a great help to the user or a nuisance.

If you try a search for something like "VB TUTORIAL" I think we have had quite a few references to them. When I can find time, I'll try to put up a list of tutorials and things like that at the top of the VB forum. Alternatively, use something like Google to search the web for VB tutorials.
Apr 30 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.