Home

Stop someone from pasting into a TextBox

This article goes hand in hand with my article called “Restrict characters entered into textbox” and I shall use pretty much the same example as I used before. If you wanted to stop a user from entering anything but numbers into a TextBox you could use the method described in the previous article, but the one problem with that is that the user ...

Read more

Using a ListView as a multi column ListBox

In order for you to get the ListView to act like a multicolumn ListBox you need to set the following properties Property Name New Value Reason FullRowSelect True If FullRowSelect is left on its default value of False then when a user selects a row then it will only be a single column ...

Read more

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