Pig Latin Visual Basic Sample

Pig Latin is a game which is played by children. Usually to make an impression that, we are speaking in different language. While there are various ways to create pig Latin from English. I just took some simple way to explain how to use string functions. So if something missing related to Pig Latin game, I may not modify, as my intention of this program is to explain string related functions  


Source Code

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase

Find Duplicate files using Vb.Net

Finding a duplicate file by file name may not be sufficient. Hence we need to compare by file data. The file might be renamed and may look like a different file. But when comparing with content of the file, we may notice that the file is a duplicate.

To find duplicate files even renamed, the content has to be compared after the content of files fetched. Once the file content is in data format, the data can be encoded with MD5 hash algorithm. The string result after hash can be used for comparing.

.NET Framework has very rich support for encrypting and decrypting, such as computing hashes and encrypting data using a variety of algorithms. Use the ComputeHash() method to compute the MD5 Hash. yes it can not be simpler than this.

This same function can be used in a recursive call to check all the duplicates. Once all the files in the directory are scann ...

Windows Forms Multithreading Treeview and Listbox in parallel

Need of Multi threading

Recently while working on a windows based media player program specially developed targeting car pc, there is a need of playlist editor which actually compiles list of songs.
In order to choose multiple files from various directories, the TreeView was being finalized as it fits perfectly for showing the songs available at the disk. Now the problem is the hard disk contains around 20 GB of songs. Populating that many songs into a tree view took around few minutes to be completed.
Till it loads the tree view no other operations can be done like selecting the nodes, and confirming the selection.  Immediately I have decided to go for multi threading as we can still work on other process in parallel.
.Net has excellent support for multi threading as it helps programming much easier when co ...

Simple way to get folder count in VB.Net

Like counting files there are some times we may need to count the folders in a given directory. Actually it is very easy to count the folders using the System.IO NameSpace. Just pass the path to the function GetDirectories and it will return the collection. Finding the count of elements will yield you the number of folers in  a give folder

Source Code(Visual Basic.Net)

Msgbox GetFolderCount("c:\") 

'******************************************************************************
    '*Purpose   : Get Folder Count Using VB.Net
    '*Inputs    : strPath(string)   : Path of the folder.
    '*
    '*Returns &nbs ...

Sample Program to get file count of a folder(VB.Net)

In Vb.Net counting files in a Directory is easier than before. it can be done in a single line.

The following function can be placed in a module or class file. And the same can be used from the other modules like

Msgbox GetFileCount("c:\")

'******************************************************************************
'*Purpose   : Get File Count Using VB.Net
'*Inputs: strPath(string)   : Path of the folder.
'*
'*Returns   :   File Count
'******************************************************************************

To Get the windows Directory in VB.net

The following function can be used to get the windows root (C:\windows or c:\winnt etc)

Environment.GetEnvironmentVariable("SystemRoot")

 

 

...

Read more here:   Get Windows Folder VB.Net 

Write INI Settings Function

Writing INI file is as easy as reading the INI files. We have to call the WritePrivateProfileString to write the values to the INI files. Compared to Read INI settings writing is much easier than reading. since just calling the API function will do the job.

'***************************************************************
'*  Purpose :   To Set Configuration Settings into  INI file
'*
'*  Inputs  :   strKey(String)          Key for the settings
'*              strValue(String)        Value for the key s ...

Read more here:   Read Write INI files using VB .Net