|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
Hi,
I am using Vb.net and I want to know how to put the Time, Date which ticks?? Please reply as soon as possible Dean PS: Please make the answer simple because I am only 11 Yrs old and New to VB "Dean" <simondevrie***@gmail.com> wrote in news:1139737865.257284.320820 @g14g2000cwa.googlegroups.com:> Hi, First, make sure you have a label or some other control on your form that > I am using Vb.net and I want to know how to put the Time, Date > which ticks?? > > Please reply as soon as possible > > Dean > > PS: Please make the answer simple because I am only 11 Yrs old and New > to VB > > can display the data. If you don't, you can create one by double-clicking the control marked "Label" on the toolbox... Next, double-click the form to open the Form.Load procedure. Stuff you put in there gets done as soon as the program starts. Copy and paste this bit of code into that procedure. Make sure you put it all on one line! Label1.Text = Microsoft.VisualBasic.DateAndTime.DateString & " " & Microsoft.VisualBasic.DateAndTime.TimeOfDay That will put the time and date on the form when the program starts, but it won't make it tick... You'll need to add a Timer to do that! The Timer is also on the toolbar, but you'll need to scroll down by clicking the arrow at the bottom of the toolbox to find it. Double-click to add it to the form. It should show up in a little tan area right below the form. Select it, and look at its properties; they'll usually show up in a big box to the right. All timers start off disabled, so you'll have to change *Enabled* to *True* to make sure it starts working as soon as the program starts. See that number *100* next to the word Interval? That's how often the Timer tries to do its job. I know it seems like a big number, but it's actually in milliseconds, which means that you need *1000* to have one second. Since the timer will only need to tick once every second, an interval of *100* means that it will only do something useful once every ten times that it's run. So an interval of *1000* is actually much better. Now double-click the timer, and add the same code that you added to the Form.Load procedure earlier. Now you should have an updating date and time in your program! (Apologies if the foregoing appears condescending; I have so little immediate experience w/ children that my assumptions & expectations may be inaccurate.) The Confessor > (Apologies if the foregoing appears condescending; I have so little Hi Confessor,> immediate experience w/ children that my assumptions & expectations may > be inaccurate.) > > The Confessor Well, I think you did a pretty admirable job with the explanation. And no, it didn't appear condescending to me, atleast. ;-) Regards, Cerebrus. The Confessor <inva***@reply.to.group> wrote in
Show quoteHide quote news:Xns9768415A63896invalidreplytogroup@130.81.64.196: From another poster, you can do date/time much more succinctly by adding:> "Dean" <simondevrie***@gmail.com> wrote in > news:1139737865.257284.320820 @g14g2000cwa.googlegroups.com: > >> Hi, >> I am using Vb.net and I want to know how to put the Time, Date >> which ticks?? >> >> Please reply as soon as possible >> >> Dean >> >> PS: Please make the answer simple because I am only 11 Yrs old and >> New to VB >> >> > > First, make sure you have a label or some other control on your form > that can display the data. If you don't, you can create one by > double-clicking the control marked "Label" on the toolbox... > > Next, double-click the form to open the Form.Load procedure. Stuff you > put in there gets done as soon as the program starts. > > Copy and paste this bit of code into that procedure. Make sure you put > it all on one line! > > Label1.Text = Microsoft.VisualBasic.DateAndTime.DateString & " " & > Microsoft.VisualBasic.DateAndTime.TimeOfDay > > That will put the time and date on the form when the program starts, > but it won't make it tick... > > You'll need to add a Timer to do that! The Timer is also on the > toolbar, but you'll need to scroll down by clicking the arrow at the > bottom of the toolbox to find it. > > Double-click to add it to the form. It should show up in a little tan > area right below the form. > > Select it, and look at its properties; they'll usually show up in a > big box to the right. All timers start off disabled, so you'll have to > change *Enabled* to *True* to make sure it starts working as soon as > the program starts. > > See that number *100* next to the word Interval? That's how often the > Timer tries to do its job. I know it seems like a big number, but it's > actually in milliseconds, which means that you need *1000* to have one > second. > > Since the timer will only need to tick once every second, an interval > of *100* means that it will only do something useful once every ten > times that it's run. So an interval of *1000* is actually much better. > > Now double-click the timer, and add the same code that you added to > the Form.Load procedure earlier. > > Now you should have an updating date and time in your program! > > (Apologies if the foregoing appears condescending; I have so little > immediate experience w/ children that my assumptions & expectations > may be inaccurate.) > > The Confessor Label1.Text = Now to both procedures, instead of that massively elongated bit of text I posted earlier. This highlights my biggest beef with VB.Net: There are generally at least three ways to accomplish any simple task, be it creating a date/time, or creating a two-dimensional control array. And there's nothing to tell you which is more efficient. The Confessor Hi,
> This highlights my biggest beef with VB.Net: There are generally at least That I have with the English language as well (what is not more than a > three ways to accomplish any simple task, be it creating a date/time, or > creating a two-dimensional control array. > > And there's nothing to tell you which is more efficient. > program language to communicate between one or more peers). If there was one way .................... than it would probably give even more misunderstandings. Cor "Dean" <simondevrie***@gmail.com> schrieb: Add a 'System.Windows.Forms.Timer' component from the toolbox to the form. > I am using Vb.net and I want to know how to put the Time, Date > which ticks?? Set its interval property to an appropriate value and its 'Enabled' property to 'True'. Double-click the component and add this code to the 'Tick' event handler: \\\ Me.Label1.Text = Now.ToShortDateString() & " " & Now.ToShortTimeString() /// -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Dean,
It makes no sense use ticks with the datetime. It is a "long" value without a real meaning, than that it starts at 1-1-1 at 1:1:1 with a non existing calendar. There is now not really any calendar anymore which really starts at 1-1-1, is it saying absolute nothing. The only way I know that it can be used is to compare if date a is equal date b. Just to give you an idea. Cor >>Hi, well Cor ,,, i hope you see it now :-) ,,,,, cause you are talking about >> I am using Vb.net and I want to know how to put the Time, Date >>> which ticks?? a different form of ticks asd the poor boy mentioned He means with ticks a ticking clock ( one that updates ) You mean with ticks the processor ticks >>PS: Please make the answer simple because I am only 11 Yrs old and New it took me a few minutes before i understood what you meant ( the poor , >>to VB poor boy ) ( just kidding ) regards Michel Posseth [MCP] Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schreef in bericht news:%23K2T$F9LGHA.2320@TK2MSFTNGP11.phx.gbl... > Dean, > > It makes no sense use ticks with the datetime. It is a "long" value > without a real meaning, than that it starts at 1-1-1 at 1:1:1 with a non > existing calendar. There is now not really any calendar anymore which > really starts at 1-1-1, is it saying absolute nothing. > > The only way I know that it can be used is to compare if date a is equal > date b. > > Just to give you an idea. > > Cor > Thank you "The Confessor" you gave the answer wanted this code for so
long!!
UI Design question
2003 0r 2005 Several TexBox in a form of an array Using GetOleDbSchemaTable and Visual Basic .NET for MS-Access and SQL Server Express Need help with LastIndexOf vb 2005 email ProgressBar Question DATATYPE PROBLEM(cross) Convert a String to a VB statement ? Q: Relationships and exceptions |
|||||||||||||||||||||||