|
-
May 1st, 2007, 10:47 AM
#1
Thread Starter
New Member
date (maybe a label?)
alright, i'm a noob to vb, this is the first forum i found, and if this is in the wrong section i'll move/delete it.
i'm trying to get the current date to show up on my application (it's going to be a shift log). i don't want to use the date picker, i am hoping i can just have it displayed in a 'label', or something nice and simple looking.
any help would be great.
-
May 1st, 2007, 10:50 AM
#2
Re: date (maybe a label?)
Welcome to the forums! 
Piece of cake. Add a label, call it something pretty, like lblDate... then whenever you need the current date, in the code just add:
vb Code:
lblDate.Text = System.DateTime.Now.ToString()
Instant date!
-
May 1st, 2007, 11:10 AM
#3
Re: date (maybe a label?)
For your info Zero Skill,
You can also format exactly how the date will be displayed. Here are a few examples:
vb Code:
'Full day/month name with / character: format of Day/Month/Year
Me.Label1.Text = Date.Now.ToString("dddd/MMMM/yyyy")
'Numerical day/month with - character: format of day/month/year
Me.Label1.Text = Date.Now.ToString("dd - MM - yyyy")
'numerical short day/month/year: format of Month/Day/Year
Me.Label1.Text = Date.Now.ToString("MM/dd/yy")
-
May 1st, 2007, 03:13 PM
#4
Thread Starter
New Member
Re: date (maybe a label?)
 Originally Posted by timeshifter
Welcome to the forums!
Piece of cake. Add a label, call it something pretty, like lblDate... then whenever you need the current date, in the code just add:
vb Code:
lblDate.Text = System.DateTime.Now.ToString()
Instant date!
thanks for the code. now if i could just get it to work (man i hate being the dumb new guy).
-
May 1st, 2007, 03:18 PM
#5
Re: date (maybe a label?)
We all start somewhere, so don't worry about it.
I might make this offer to too many people... but if you use AIM or MSN, check my profile and hit me up if you need help. I'm usually online and always willing to help.
-
May 1st, 2007, 03:55 PM
#6
Thread Starter
New Member
Re: date (maybe a label?)
 Originally Posted by timeshifter
We all start somewhere, so don't worry about it.
I might make this offer to too many people... but if you use AIM or MSN, check my profile and hit me up if you need help. I'm usually online and always willing to help.
thanks for the offer. I got it working... i guess i have to click on it to change from text to the datetime. i changed _click to _load but that didn't make a difference.
-
May 1st, 2007, 03:59 PM
#7
Re: date (maybe a label?)
Did you try the Form_Load event?
-
May 1st, 2007, 07:43 PM
#8
Thread Starter
New Member
Re: date (maybe a label?)
 Originally Posted by timeshifter
Did you try the Form_Load event?
Event 'Form_Load' cannot be found.
-
May 1st, 2007, 07:49 PM
#9
Addicted Member
Re: date (maybe a label?)
 Originally Posted by Zero Skill
Event 'Form_Load' cannot be found.
go back to the designer, and create it
you create it by double clicking the form's title bar... or by selecting the form and viewing the properties, clicking the lightning bolt (events) button, and double click the empty space next to form load.
I could probably offer some help too... I'm not a guru, but I have the main idea of how to get things accomplished (whether or not it is the "Proper" way... I tend to create tons of variables where arrays could be used, and use un nesscesserry logic)... I was just like you not too long ago. I'll add my IM and MSN to my profile, feel free to contact me whenever I'm online 
After a few weeks with VB, you should really be quite good at it (well, not the SQL side, but that's a whole other story). It's basically this.that.blah = something.else * 8... everything is easy to remember because they use simple properties... text, size, color... They are what they say. Oh... play around with CTRL + Space Bar... when you are typing your code, it can really help you fine the property/attribute that you need
Last edited by rbxslvr; May 1st, 2007 at 07:57 PM.
-
May 1st, 2007, 08:03 PM
#10
Thread Starter
New Member
Re: date (maybe a label?)
i am an idiot.
i was double clicking on the label, then putting the code in the label's sub. this time, i put it in the form's sub and it worked like a freaking charm!
thanks everyone for the help.
is this the proper section to ask general questions like this? my first project is a shiftlog for a small business, and i'm sure i'll have a million other questions.
thanks again.
0skill
Last edited by Zero Skill; May 1st, 2007 at 08:22 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|