Visual Basic Articles and Tips

The IIf() Function

The IIf function denotes immediate decision function. It provides a simple decision-making process based on three arguments, as follows:

      IIf(x, y, z)

x represents a logical expression while y and z represent a numeric or a string expression.

For example, the IIF(x>y, expression 1, expression 2) function evaluates the values of x and y, if x>y. then expression 1 is true, otherwise, the expression 2 is true.

To learn more about the function and its application, follow the link below:

http://www.vbtutor.net/lesson7.html

 

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

ASC Character Converter

We can create a Asc to Chr and Chr to Asc converter in VB. Let’s examine the following Example:

In this example, we create two buttons, label one of them as ASC and the other one as CHR. Insert two textboxes, one for the user to enter an ASC code and the other one to enter the CHR character. When the user enter an ASC code, he or she can check for the corresponding character by clicking the CHR button. Likewise, he or she can check the corresponding ASC code after entering a character.

The Code

Private Sub CmdASC_Click()
TxtASC.Text = Asc(TxtCHR.Text)
End Sub

Private Sub CmdCHR_Click()
TxtCHR.Text = Chr(TxtASC.Text)
End Sub

Please refer to the following article for more details.

http://www.vbtutor.net/lesson13.html

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

Dynamic Arrays

Array size is often defined during design time. This type of array is known as static array. However, the problem is sometimes we might not know how many data items we need to store during run time. In this case, we need to use dynamic array where the number of elements will be decided during run time. In Visual Basic 2017, the dynamic array can be resized when the program is executing. The first step in declaring a dynamic array is by using the Dim statement without specifying the dimension list, as follows:

Dim myArray()

Then at run time we can specify the actual array size using the ReDim statement,as follows:

ReDim myArray(n)
* n =array size
You can also declare a two dimensional array using ReDim statement, as follows:

ReDim myArray(n, m)
*mxn indicates the array size.

Read more here
http://www.vbtutor.net/index.php/visual-basic-2017-lesson-10-working-arrays/

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

Visual Basic 2017 Tutorial

Our Visual Basic 2017 tutorial is finally ready!

Visual Basic 2017 is the latest version of Visual Basic launched by Microsoft in 2017.  Visual Basic 2017 is bundled together with other Microsoft Programming languages C#  C++ , F#, JavaScript, Python and more in a package called Visual Studio Community 2017 Release Candidate . Microsoft has added many new features in Visual Studio 2017 particularly those features for building  mobile applications .

Start learning Visual Basic 2017 by clicking the link below:

http://www.vbtutor.net/index.php/visual-basic-2017-tutorial/

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone