94 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for oussama_1

VB.Net never meant for games! it's more recommended for software developement, but hey why not have some fun. If anyone out there is looking to create an Angry Birds Game-like or a Simulator for throwing an object, you've come to the right place, this code will give you great start/push …

Member Avatar for joy_731
1
3K
Member Avatar for Santanu.Das

Now I am going through a project with colors. And then I think that if I try to display color values with their names in a simple combobox, it could be amazing. I tried and did it and it is looking like ![Capture3.png](/attachments/small/4/4473f7608016edcb5981090cccc80593.png "align-left") And ![Capture4.png](/attachments/small/4/87a5e5686d66033648a3e0ab787d6778.png "align-left") And finally the …

Member Avatar for michael.allen02
0
5K
Member Avatar for richardmagaisa

If Me.cbobraketype.SelectedItem = ("Rim Brakes") Then braketype = ("Rim Brakes") price = "£120" braketype = ("Rim Brakes") ElseIf Me.cbobraketype.SelectedItem = ("Disk Brakes") Then braketype = ("Disk Brakes") price = "£150" braketype = ("Disk Brakes") End If 'choose type of frame If Me.cboframetype.SelectedItem = ("Aluminium") Then frametype = ("Aluminium") End If …

0
91
Member Avatar for tinstaafl

There are times when you need to make sure your counter starts at an odd or even number. Even is pretty simple - `counter = counter + modulus(counter)`. If counter is even it stays, if it's odd it gets incremented by 1. Odd is a bit more complicated - `counter …

Member Avatar for holisticgroup19
3
4K
Member Avatar for Reverend Jim

A long standing complaint with the standard progress bar control is that there is no easy way to display text. In spite of numerous requests, Microsoft has not included this capability. The following code includes a class, `CustomProgress` which inherits the standard `ProgressBar` and adds such a feature. It is …

Member Avatar for Mark@SF
4
79K
Member Avatar for Reverend Jim

As part of a project to manage my collection of photos, I wanted to add the capability of displaying a series of files as thumbnails. This posed me with three problems: 1. how to preserve the aspect ratio of the original images 1. how to generate the thumbnails without tying …

Member Avatar for mariopepper
3
3K
Member Avatar for vbacoder1962

This was a query raised by one of a forum members at another site, where he had a worksheet filled with random numbers, and I have already answered that query [at my post here](https://vbacoder1962.wordpress.com/2019/07/15/extracting-cell-phone-numbers-from-random-strings-of-variable-length/). You may go through that post and read the logic behind the code. ![vbacoder_Code_20190715.jpg](/attachments/large/4/160efbe4e4d0a8400d04653a6e420c7b.jpg)

2
1K
Member Avatar for Edwin_11

**I would Like to Use this code after you have clicked into your textbox And I am Edwin Have a good Time**

Member Avatar for Dani
0
770
Member Avatar for Unhnd_Exception

I was so amazed at how easy it was to embed google maps into a vb app I decided to post a quick example to help anyone get started. This is a simple example. Google's api has all kinds of things to help customize your map. You can find out …

Member Avatar for Jorge Braga
4
8K
Member Avatar for Reverend Jim

Several people have asked how to export data to Excel. This code snippet shows how to export the data from a listview in details mode to a new Excel spreadsheet. Take note of the comments in the header to avoid having orphaned Excel.exe tasks eat up your system memory.

Member Avatar for Reverend Jim
7
9K
Member Avatar for xrjf

The present code snippet just does an especific task. This is, given an ordered sequence of natural numbers, starting at zero, generate all the different permutations there can be. When we talk about permutations, the order of the sequence does matter. So, the sequence 0, 1, 2 differs from 2, …

Member Avatar for xrjf
0
2K
Member Avatar for Reverend Jim

Here's an interesting little scenario. You get challenged to a game of coin toss. Both players pick a sequence of coin toss results (heads or tails). The coin is repeatedly tossed until the sequence for one of the players occurs. The loser pays the winner a dollar. You'd assume that …

Member Avatar for xrjf
0
2K
Member Avatar for J.C. SolvoTerra

# BlowFish? # BlowFish was the brain child of Bruce Schneier back in 93. Since BlowFish was released to the public domain, Bruce Schneier has released new encryption algorythems, TwoFish and ThreeFish. BlowFish is an increddibly popular and very strong algorythem. Because it conforms to Kerckhoffs's Principal [Explained Here](http://en.wikipedia.org/wiki/Kerckhoffs's_principle), even …

Member Avatar for zen_1
0
1K
Member Avatar for J.C. SolvoTerra

There are many examples of compressing files in VB.Net. So many of these examples are using third party libraries which is just not neccesarry. People were saying that files and archives exceeding 4Gb couldn't be used... I hate restrictions and decided to "Stick it to Microsoft" To get a better …

Member Avatar for Cristhian_1
1
2K
Member Avatar for powerade661

Hey guys, does anyone know how to do this? Here is my current code that will not work. I have tried everything that I know how to make this work to no avail. This is under form1_load. Any help would be awesome. Thanks in advance.

0
362
Member Avatar for Begginnerdev

Here is a small extention of the Panel class that allows you to 'collapse' it. So far, the user can place a control on the parent form and perform a collapse/expantion by: 'Where cpNew is a Collapsible Panel If Not cpNew.PanelCollapsed Then cpNew.Collapse() 'or If cpNew.PanelCollapsed Then cpNew.Expand() I will …

Member Avatar for parjor
0
2K
Member Avatar for major_lost

I know that this probably has been done by someone, but I want to learn how to do this using VB 2010 express. I cannot seem to get the numbers to stay in the text boxes that they are dropped in. The numbers always go to the last box (#81). …

Member Avatar for Reverend Jim
0
476
Member Avatar for iPoor
Member Avatar for iPoor
0
4K
Member Avatar for TnTinMN

I have just seen a resurrected thread about issues with loading images to a PictureBox and the inability to delete the file while the program is running. There was no clear explaination of the problem, only suggested hacks and apparent frustration. So I thought I would offer this explanation from …

Member Avatar for J.C. SolvoTerra
0
6K
Member Avatar for TnTinMN

I am posting this in response to those who ask about replacing the webbrowser (WB) control’s default browser. You cannot ask the WB control to use a different browser, it is hardwired to use the current version of Microsoft’s Internet Explorer that is installed on the target computer. It may …

Member Avatar for Jim_8
1
3K
Member Avatar for J.C. SolvoTerra

=======Download The Full Solution Below======== This will be my last VB.Net soure as I've made the move to C#. For a recent job application I was given the technical test to create a horse race simulator which would calculate the odds of a runner winning a race of up to …

1
872
Member Avatar for djjeavons

This snippet demonstrates how you can add VBA code to an Excel file at run time. **Prerequisites** In this snippet I am using Microsoft Excel 2013 with the Microsoft Excel 15.0 object library. Before you can use this code, you will have to change a setting within Microsoft Excel to …

0
1K
Member Avatar for xrjf

By means of Mates8, graph coding becomes a bit easier. The web page has four textboxes so the figure gets bounded to the left, right, top and bottom; and a draw button. Additionally, a panel control will contain the image generated by the code after the button is pressed.

Member Avatar for xrjf
0
563
Member Avatar for Santanu.Das

This conception I get from a post on CodeProject by [Heriberto Lugo](http://www.codeproject.com/Tips/837177/Recursion-for-Beginners-Sorting-Ten-Numbers-Withou). But that was for only 10 numbers. Then I had an idea to use it in vb. There are many shorting process like Bubble Short, Linear Short etc. But exceptionally it does not use loops as others do. …

Member Avatar for David_50
0
520
Member Avatar for J.C. SolvoTerra

Using .Net's SHA1 Crypto Service to compare hashes between a user's password and their stored hashed password. Simplez =0)

0
866
Member Avatar for J.C. SolvoTerra

I was just mucking around with a progress feature for some software, and thought I'd just put this wee demo up of a clocky type progress thing =0) Just Copy and paste the form code and watch it run. (p.s it's in degrees, note minutes and seconds) ![55f1addda67a729e91ae90c980c39deb](/attachments/small/4/55f1addda67a729e91ae90c980c39deb.png)

Member Avatar for J.C. SolvoTerra
0
238
Member Avatar for J.C. SolvoTerra

After trying to manipulate PNG files and failing miserably discovering that the standard GDI doesn't provide support for any PNG parameters decided to provide some basic image manipulation functions built into .Net that I came across on my investigations. 1. Adjust Image Quality 2. Flip Image Horizontally 3. Flip Image …

Member Avatar for Santanu.Das
1
2K
Member Avatar for J.C. SolvoTerra

Did you know that you can data bind a bitmap to a PictureBox's image property, and the source image doesn't have to be in a binary format stored in a data table? Using a standard object setup for data binding (iNotify etc.) you can easily update your program's image propertie's …

0
1K
Member Avatar for J.C. SolvoTerra

NOTE: The games GUI is not fully implemented, so changing it's image and difficulty is done manually in the Button.Click Event NOTE: Whether you download the VS2013 source file or copy and paste the code, you need to download, and extract the two image files to the project's "Bin\Debug" directory. …

Member Avatar for J.C. SolvoTerra
1
305
Member Avatar for J.C. SolvoTerra

>Take Heed There are lots of things to be aware of with the Windows Registry. In most cases the best thing to be aware of is that ideally you should avoid playing with it at all costs. Alas, we are what we are and we do what we do. My …

0
1K

The End.