Home

Restrict characters entered into textbox

If I had a pound for every time I saw someone post asking how to do this on a forum, I would be a rather rich man. Lets assume you wanted to have a textbox that would only allow for numbers to be entered, you would need to check each time a key is pressed, obviously this wouldn’t deal with the user pasting text into the TextBox but you would be...

Read more

Check to see whether a form exists at runtime

If you want to check whether a form exists in your project at runtime you can use the following method, you will need to ensure that you import System.Reflection in order for this to work. ''' <summary> ''' This method deals with checking whether a form exists within the current project ''' </summary> ''' <param name="formName"&g...

Read more

Get an instance of a form dynamically at runtime

There is sometimes a need for you to be able to dynamically choose a form to load at runtime, in order to achieve this you’re able to use the following code, you will need to ensure that you import System.Reflection in order for this to work. It is also recommended that you check for the existence of the form in your project prior to trying to ...

Read more

Dynamically adding and later referencing control

This is something that was asked how to do in one of the forums I post help in. Basically the user wanted to know how to dynamically add controls to your form and then refer to them later in the program. The following code gives you an example of how you are able to achieve this; Public Class Form1 Private Sub Form1_Load(ByVal sender As S...

Read more

How to log into a website from VB.Net

Something that seems to get asked at least 3 times a day in the forums that I hang around on is how to get their application to be able to log into a specific website. This is something that is fairly easily done under the right circumstances. For this example I am going to get my application to log into the VB Forums website. There is no parti...

Read more

The use of the Random class

One thing that I see commonly come up on forums is people saying things like “I am trying to get several random numbers but I’m getting the same number every time”. The problem is that many people don’t understand how the Random class works or how to implement it. First I’ll show you an example of what I’ve seen people do. For this example you ...

Read more

Compare versions of application

It is common for you to want to check whether your application is the latest version of the application. It is possible to compare the version of your application against a version number that you have as a string You can achieve this by doing something like; Dim curVer As Version = My.Application.Info.Version Dim availVer As Version = New Ver...

Read more

Retrieving your forgotten wireless password

I recently set up a wireless network in my new flat with a super duper awesomely strong password, set up my laptop to connect to the wireless and then promptly forgot to actually write down what the wireless password was. Thankfully some genius had already experienced this problem and had created an application to retrieve wireless passwords fr...

Read more