rvalkass
Apr 6 2006, 08:43 AM
This tutorial will explain how to create a basic timer using Visual Basic Express 2005. If you don't have it, it's free and you can dowload it from Microsoft's website. All you need is a few minutes to sit down and read this and a version of Visual Basic. OK, so what will this timer actually do? Well, you are able to enter a number of minutes and a message, and then click a button. Once the timer is up, your message pops up and you are reminded! So, basically it's a little reminder system. I use it to remind me when TV programmes start, when I have to go somewhere, all sorts of things, and I'm sure you'll be able to find a use for it too. Start off by opening Visual Basic. I'm using the 2005 Express Version, but this should work with most versions, but things will look different. Create a new project by clicking File > New Project.... Give it a logical name and click on OK. ScreenshotYou are presented with the customary blank form. Drag on a NumericUpDown, a TextBox and a Button. Arrange them something like this, but you can use your own layout. Then drag on a Timer, and you can place this anywhere, as it will appear at the bottom of the screen. That's the layout done! OK, onto the code. Right click on a blank section of the form, and select View Code. You will now be presented with this: CODE Public Class Form1
End Class
What we need to do first is detect when the button is clicked, and start the timer up. Above the code area there are two drop down boxes. These allow you to choose various actions for the code. Change the left hand side one to say Button1 and the right hand one to Click ( Screenshot). Some code will be automatically added, and whatever you put between it will happen when the button is clicked. Between those two lines, add the following code: CODE Dim Minutes As Integer = NumericUpDown1.Value Timer1.Interval = Minutes * 60 * 1000 Timer1.Enabled = True MsgBox("The timer has been set.", MsgBoxStyle.Information And MsgBoxStyle.OkOnly, "Timer Set")
Lets go line by line. The first line creates a new variable which will store our time. It takes the number from our NumericUpDown1 and stores it as an integer. The next line sets the interval of the clock to 60,000 times what is in the variable. This is becuase the timer only accepts times in milliseconds, so if we times the number of minutes by 60,000 we convert it to milliseconds. The third line starts the timer, and the last line prompts you with a notice to say it works. Now we need to set what happens when the timer has finished. Back on those two drop down lists, choose Timer1 in the first one and Tick in the second. Between the two new lines, type this: CODE Dim Reminder As String = TextBox1.Text MsgBox(Reminder, MsgBoxStyle.Information And MsgBoxStyle.OkOnly, "Your Reminder!") Timer1.Enabled = False
Again, line by line. The first line takes the text you type in the text box and copies it to a variable. This variable is then set as the main text in a message box, which is displayed when the timer is up ( Screenshot). The final line turns the timer off, otherwise it would run infinitely and you would be reminded every few minutes of your message. That's it, the code is finished. To try it, click on the green start arrow in the toolbar at the top, or push F5. You can of course add labels to the form to give some idea of what needs to be written in it. One modification I would definitely make, however, is making the text box accept multiple lines, which can be displayed in your message box. To do this, go back to the form designer tab, and click on the text box. On the right hand side, in the properties panel, scroll until you find the property Multiline and change it to True. Now you can drag the text box to make it taller and fill the available space on the form. You can also rearrange things and change the size of the form. After a bit of touching up, mine looks like this. To turn your application into an EXE file you can run, click on Build > Build Project Name. If you get any errors, post them here, PM me or email me and I'll do my best to help.
Reply
kody
Oct 27 2006, 05:59 PM
I've tryed this one and I think it's not working. Somehow the timer doesn't start and I don't get the reminder to fire up. I've even replaced Timer1.Interval = Minutes * 60 * 1000 with Timer1.Interval = 5000 ( 5 sec) and doesn't start either. Can you please tell me why ?
Reply
timvk
Sep 25 2007, 07:17 PM
i made another topic for my question: http://www.trap17.com/forums/index.php?showtopic=51758hope you could help me, sorry
Reply
de4thpr00f
Nov 22 2007, 05:29 AM
This is very useful, it's working. I just set this to run on background so i'm not bothered with the minimized window  great job.
Reply
Forbez
Nov 22 2007, 04:26 PM
I'll try this later, but so far it's looking really good. Nicely written and easy to follow. Thanks.
Reply
iGuest
Mar 17 2008, 10:16 AM
vb program
Creating A Timer Program
Can you help me with this project? This is the problem: Consider a computer system in which "computer games" can be played by students only between 10pm and 6am, by faculty members between 5 pm and 8am, and by the computer staff at all times. Make a simple program using vb you want to answer the scenario above. -reply by Ruben Vasquez
Reply
azri92
Mar 20 2008, 09:29 AM
FLaKes
Mar 20 2008, 06:34 PM
Nice, this looks like a really good and easy tutorial for beginners to visual basic. Also, I didnt know there was a free version, so thanks for that also
Reply
tricky77puzzle
Mar 20 2008, 11:43 PM
Or, alternatively, if you want to use the timer to keep track of some event, instead of a reminder, you can set the following as well: CODE Dim seconds as Integer = NumericUpDown1.Value * 60 MsgBox("The timer was set to " & seconds \ 60 & " minutes and " & seconds Mod 60 " seconds.") The backslash is integer division. Basically, 3 \ 2 = 1.5, which rounds down to 1. To make this work, you will have to preset the Timer's interval to 1000, as well as add a label. Name it Label1. In the code display, under Timer1.Tick, add the following code: CODE seconds = seconds - 1 Label1.Text = seconds \ 60 & ":" & (seconds \ 6) mod 10 & seconds Mod 60 This little tidbit of code displays the minutes:seconds. For example, if the time left was 8 minutes and 30 seconds, It would display "8:30". Then add: CODE If seconds = 0 then MsgBox(TextBox1.Text) like the original program.
Reply
Recent Queries:--
timer in vb 2005 - 1.35 hr back. (1)
-
how to make a simple timer in vb - 2.58 hr back. (1)
-
vb 2005 timer - 1.80 hr back. (3)
-
tutorial making server client visual basic 2005 express - 6.10 hr back. (1)
-
vb.net timer return timer time left - 7.08 hr back. (1)
-
timer in visual basic 2005 - 7.93 hr back. (1)
-
sample program vb with timer - 9.40 hr back. (1)
-
create timer using vba - 9.63 hr back. (1)
-
timer vba - 10.49 hr back. (1)
-
initializing a timer vb6 - 13.53 hr back. (2)
-
timmer function is writen in javascript i want to display timer at lable - 14.40 hr back. (2)
-
using action command on swing timer java 1.5 - 15.83 hr back. (1)
-
timer example visual studio - 15.85 hr back. (1)
-
vb declare timer - 19.22 hr back. (1)
Similar Topics
Keywords : creating, timer, program, visual, basic, 2005
- Create Dynamic Html/php Pages Using Simple Vb.net Code
Taking your application data, and creating a webpage for others to vie (1)
How To Start Your First Game Project
The first steps to creating your own game! (0) Ok, I see alot of questions around the game development forums of people wanting to make their first
game, but they don't know where to start. So, I decided to write this tutorial, having been in
the same situation before. NOTE: This Tutorial: -Is meant to help you get past that initial bout of
developer's block -Does not teach you how to make a game, just help you start -Cannot help you
if you cannot answer the questions asked So, let's get to it, shall we? How to start
your first game project: --So, the first thing you need to make sure yo....
Getting Started With Mysql
creating tables and insert data into them. (2) Hi in this tutorial you will learn how to create tables and insert items into them. First steps are
to create the database - go into your cpanel and mysql databases, from there make an account and a
database and then attach them together with all priviliges, call the database test and the account
admin, with the pw as pass - or any other password. We need to connect to the database so first in
your php file (probably named index.php) - this is how to do it. CODE
mysql_connect("localhost", "admin", "pass") or
die(mysql_error(&....
Ftp In Visual Basic 6.0
Start making your FTP client using VB6 (1) Recently, I had a need to make a FTP client, since our webhosting FTP server was kind of exotic, and
very restrictive, and most of uploads, even though they reach 100% would crash... File would be
uploaded to a server, but FTP clients just froze upon completion, waiting for the 226 (OK) from FTP
server... So, I had to make my own, one who would not wait for 226, but instead, watch the file
pload progress... This tutorial is not fuly complete, in the sense that it does not offer COMPLETE
FTP client functionality (for example, I ddn't write the code for FTP download, ....
Creating Navigation For Html Websites
Have a common navigation menu for the whole website! (12) Pre-requisite: HTML, inline frame tags 1 Attachment(.zip) included. Updates : 29-12-07: Doctype
added in example files (Advised by jlhaslip) Designing a whole website takes a lot of planning
and organization. Designing a proper navigation system is a basic step in building your website. If
you are developing webpages in html you would have observed that as you go on creating pages it
becomes difficult to maintain the links to the pages. This article will guide you in developing a
common navigation menu for your website. It describes three ways, so if you don'....
Creating A Resume
10 Tips For Making A Resume (1) I've been working on my Resume for months now. Here is a summary of what I've learned: 1.
Avoid referring to yourself via 1st person or 3rd person terms. Rather than saying "I started this
job in" just say "Began job in"... Employers expect Resumes to be professional and avoid reference
to oneself; and instead speaking in an impersonal tone that presents
achievements/skills/experience/education without personalization. Avoid words like "I", "my", "he",
"she", etc. Leave out personal pronouns and only use the action words/verbs. This also includes
your Ob....
Making a java based program
(3) Java GUI Making a Little Java Program Sec. 1: Imports and starting it off Sec. 2: Variables Sec.
3: Frame and Stuff Sec. 4: Declaring buttons Sec. 5: Adding buttons Sec. 6: Action Listening Sec. 7:
Using this for a learning experience Section 1 Now, let's think. What imports do we need? We
obviously need GUI imports. We also need the action Listener. So, let's declare this at the very
top: Code: CODE import java.awt.*; import java.awt.event.*; import javax.swing.*; That's
all we need to get all our supplies. Now to start us off. Skip a couple lines ....
Programming In Glut (lesson 4)
Creating 3D objects (0) Lesson 4 of 6. I hope you are enjoying them /laugh.gif" style="vertical-align:middle"
emoid=":lol:" border="0" alt="laugh.gif" /> . QUOTE Hello, in this tutorial we will be creating
a 3D pyramid. We are building this tutorial from Lesson 3, but I took out the 2D objects and placed
a 3D pyramid in there instead. The 3rd axis for drawing can be a litle confusing, but after you get
the hand of it you'll do fine. Now when you are setting a 3D vertex just remember that the
camera is on the positive end of the z axis. So things that have a more positive z axis va....
Programming In Glut (lesson 1)
Creating a windwo (0) This is the first of six lessons I am transferring from Astahost for programming in GLUT, and after
the six I hope to make more, I hope you enjoy. QUOTE Hello, I'm starting a series on how to
program in OpenGL using the OpenGL Utility Toolkit, a.k.a. GLUT. I chose GLUT because it is quick
and easy to write, and very easy to learn. In this tutorial I am going to teach you how to create a
basic window which we will build off of in later tutorials. Throughout the tutorial I will leave
notes to let you know what each command does, and how you can modify it to fit....
Tutorial: Creating Custom Icons For Devices
Give that device a great icon every time you plug it in! (0) Ok for this tutorial I will use the PSP as an example of the device, this should work for every
device. (THIS WILL NOT HARM ANYTHING AT ALL!) First off, open notepad and type in:
ICON=ICONE.ICO Save that as AUTORUN.inf Now, find a picture you like.. make sure its dimensions
are 16X16 pixels. Put it in the main folder of the device, for example, my psp is located at
F:\, i would type in F:\ to the adress bar and put the picture in that folder, as it is
the folder your computer automatically reads, anyways, put your picture in there and name it: ICO....
Creating A Simple Image Viewer
Using Visual Basic 2005 Express Edition (4) I downloaded Microsoft's Visual Studio Express suite a few months ago, but only recently got
around to installing it. I have been practising with Visual Basic and making some rather basic
programs and utilities, but they contain most of the basic concepts. This tutorial will explain how
to create a basic image viewer, and I will try to explain each step from beginning to end as clear
as I can. To start you will need: Microsoft Visual Studio About 10-20 minutes free time OK,
first open up the Visual Basic part of the Studio. I am using the 2005 Express version, so....
How To Make A Web Browser
Visual Basic 6 (49) This is a simple and specific tutorial on how to make a basic web browser in Visual Basic 6. Steps
1-3 Create a new project, and then go to "Project" on the menu. Click components as shown in the
following image. Find the component "Microsoft Internet Controls," check it, and click "Apply" and
then "Close." Click the icon that was just added in the tools window, and draw a large sized
window with it. This is going to be where you view webpages through your browser, so don't make
it small, but leave room for buttons and other accessories. Steps 4-6 Make a t....
Getting Started With Amfphp And Rias
first steps in creating RIAs (2) AMFPHP in a short way is a library of php files that let u manage in JUST ONE FILE what u would do
in many files like for example queries to mysql. So u can have tons of queries to mysql and all of
them in just ONE FILE! so what is a RIA? a RIA is a Rich Internet Application commonly given
to flash applications, not the animations or presentations we see daily on the internet but very
useful and cool programs made in flash. the fisrt step u need to take is to download the AMFPHP
library directly from its site at www.amfphp.org, in some free hosted sites the latest....
Bit Shifting In Vb
Shifting bits in Visual Basic (0) This is for all Visual Basic programmers out there, who want to programm some form of encryption
algorithm, or anything else that includes shifting bits left or right, for that matter. Most of you
who have tried to accomplish this, know that Visual Basic doesn't have any function for bit
shifting. And bit shifting si very usefull /smile.gif' border='0' style='vertical-align:middle'
alt='smile.gif' /> Some of you probably know how to shift bits, but this tutorial is for those who
don't know how to do it... Shifting bits is actualy easy, we use multiplication ....
Delete Files And Directories Using Php
following up from creating and writing (7) How To Delete Files and Directories follow up from creating them Hello all and
welcome to my second tutorial involving file management. In my previous tutorial , I explained how
to create, write and read files. In this tutorial I'll explain how to remove the files and
directories you took so long to create. I did not explain last time how to create directories as I
did not know, now I do, you can use the mkdir() function. Now with this tutorial.... Removing
Files Removing files can easily be done with the unlink() function: CODE <? un....
Simple Login In Visual Basic 6
user interaction example trough login programm (6) First of all, I am NOT a programmer, this is something my friend taught me. It describes basic
interaction with the user, while showing basic functionality of this simple programm. So, without
further ado, we're off to the tutorial: First of all, start your visual basic, when prompted
for new project, select Standard Exe . Next, we need to open code window, so we can start typing
the program. This can be done in two ways, one is double clicking on the form, or selecting Code
from View menu. If you double clicked on the form, you will see following text: CODE ....
Creating Rollovers With Buttons
Short & simple javascript tutorial that shows you how. (2) Javascript in action can render some very neat visual effects, which can make your website more
appealing, and sometimes even easier to navigate. Among the most common effects are the
'button' effect, and the mouseover effect. The buttons are very common, of course; if
nowhere else, most of us have seen them at the end of forms (Click the 'submit' button to
proceed...). The basic idea is to have a 'depressible' object, which can give you the
illusion that you're 'pressing' it when you click it. The rollover effect causes
something to h....
Creating Your Own Icon
(23) It is easy to create your own icon, just pick a bitmap (.bmp) file and change its extension to .ico.
To do so, open the Windows Explorer, click on the View menu (or Tools in WinMe), click Folder
Options, click View tab, remove the check on the "Hide file extensions for known files types"
option, and then click OK. Select a bitmap file, press F2 key, and then change its extension to
.ico. Have fun learning:)....
Creating Personal Alarm
To remind you something (2) Creating Personal Alarm This personal alarm is very useful to remind you something or anything you
would like it to do. Use Task Scheduler application to create your personal alarm. First, click on
Start -> Settings -> Control Panel -> Scheduled Tasks. Now click on the Add Scheduled Task wizard
in the Task Scheduler folder. Click Next, click the Browse button, and then select your favorite
sound files (WAV/MP3/MIDI). Set the file to open as the task daily. Set it at the top of the hour
every day, open up its advanced properties. On the Schedule tab press the Advance....
Simple Visual Basic 6 Tutorial
Tutorial 1: Msgbox (0) For this tutorial you will learn how to make a very simple, and basic program. Step one- Create a
new form. Step two- Click the command button on the side and make two buttons. Step Three- Click
on on of the command buttons you drew, and on the side there will be a menu. Change the caption to
Button 1, and repeat the same with the other button, but the caption Button 2. Step four- Double
click one of the buttons, and put in CODE Dim button button = MsgBox("What you want to
say here", 65, "Title") Now change that code to what you want it ....
A Guide To Css And Creating A Stylesheet
(15) Table of Contents: I. Introduction II. Starting your stylesheet --A. Starting syntax with
font-family --B. Defining classes --C. Using classes III. The STYLE tag IV. Comments in CSS V. The
"a" tag VI. A quick list of common attributes VII. Notes --A. Universal classes --B. Grouping --C.
Multiple instances VIII. Finding other attributes IX. Closing I. Introduction Firstly, to begin
using a stylesheet, you must have one. Open up your text editor and save as (something).css. I know
NotePad doesn't need quotes for a stylesheet, but I'm not sure about other progr....
Creating Your Own Php News System
(23) Hello, heres a simple tutorial from a script that I made to power my news system. It is written
withthe PHP coding system and consists of 8 files using a flatfile based system, without MySQL
databases. This should be usefull for those who want a simple little news manager and like to have
simplcity without the fancy date strings and sutff. You can see a demo of it at my site @
http://www.xeek.trap17.com . Let's Start! First let's start with the easy stuff,
making the directory first, first create a main directory to hold everything, call this folder "ne....
[tutorial] Visual Basic 6
Adding Commas to Large Numbers (0) This isn't a very long tutorial. I get asked this often, so here is the solution. The following
code will return a string containing a number that has commas appropriately placed: Code:
myStringOrProperty = FormatNumber(3587532789053, 0) The second parameter (0) represents how many
decimal places you want the returned number to go out to. Unless your number contains its own
decimal, you probably don't want .00 at the end of every number you have. The above code would
return: 3,587,532,789,053 This should make life easier for many.......
[tutorial] Visual Basic 6
Closing Programs Right, Why END is bad (4) This tutorial applies to all those people who insist upon using "End" to close their programs: End
stops the program immediately without any thought as to what's going on - it's like a high
speed train hitting a brick wall. It can cause unwanted errors and is bad programming practice in
general. END gets rids of the form, but NOT its leftovers. This leaves a bunch of memory that will
still be in use even after your program has supposedly closed. An object or variable won't be
terminated properly - it's just not a graceful exit. The only time that it'....
Looking for creating, timer, program, visual, basic, 2005
|
*RANDOM STUFF*
*SIMILAR VIDEOS*
Searching Video's for creating, timer, program, visual, basic, 2005
*MORE FROM TRAP17.COM*
|
advertisement
|
|