469,150 Members | 1,960 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,150 developers. It's quick & easy.

NumericUpDown Control

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
3 3422
Killer42
8,435 Expert 8TB
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
samud
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
Killer42
8,435 Expert 8TB
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.

Similar topics

reply views Thread by Koert | last post: by
1 post views Thread by Tantra Veda | last post: by
10 posts views Thread by Bonj | last post: by
reply views Thread by Koert | last post: by
2 posts views Thread by bnob | last post: by
2 posts views Thread by =?Utf-8?B?U2hhcm9u?= | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.