Creating A Timer Program, Using Visual Basic 2005
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.
You 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 . 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.
Webhosting - 0.99$/Pay monthly 1 GB Space, 5GB BW, Cpanel etcdel.icio.us Digg it Earthlink Furl iFeedReaders ma.gnolia Maple.nu Netvouz Netscape RawSugar reddit Scuttle Shadows Simpy Spurl StumbleUpon Wink Yahoo MyWeb
How To Get Remote Access To Your Wireless Router - A basic Guide
There is a way that you can use remote access to your wireless router… in fact your whole home network for free with no software downloading or anything. Quite a few wireless routers I’ve come across (h**ked) can be configured for remote access, you just set the password and the port for the remote access. To get to the router, you would type in it’s local address. There should be a load of settings for you to manipulate, although the router will be password protected. you can find the default password and username for the router in the manual you got with it. They username is usually “admin” and the password is either “password” or “1234″ etc.
Right. So you’re logged in to your router, check some of the settings, snoop around and learn the feel of it. You will find settings either labled “Remote Access” or “Network Options” etc. Go for these. Then, modify the setting so it’s enabled and enter a password and username (if the username is required) For instance, say I chose port 65, and a password of… “laurencetelesia” (For the dumb and ignorant, no quote-marks in the actual password. This may seem like overkill, but seriously, some people these days.).
From a different computer (location, country if you wish) I would enter the external IP address of the network with the port after a colon. eg. I would enter in the address bar of my web browser: (again with the quotes thing) “http://86.80.32.135:65″
After doing all this I would likely get a prompt to enter your password, which in this case is (quotes thing again) “laurencetelesia” (don’t ask why that’s the password I chose). After entering the password, everything should be fine and dandy. You should be able to access printers from here and generally mess around with the router’s settings… not that you would do that to your own router. ‘Cos that’s the only router you would remotely access
Have fun. Stay safe. And there’s usually an option to reset all settings
Webhosting - 0.99$/Pay monthly 1 GB Space, 5GB BW, Cpanel etcdel.icio.us Digg it Earthlink Furl iFeedReaders ma.gnolia Maple.nu Netvouz Netscape RawSugar reddit Scuttle Shadows Simpy Spurl StumbleUpon Wink Yahoo MyWeb « Previous Entries Next Entries »















