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:
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.
Private Sub CmdASC_Click()
TxtASC.Text = Asc(TxtCHR.Text)
Private Sub CmdCHR_Click()
TxtCHR.Text = Chr(TxtASC.Text)
Please refer to the following article for more details.
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:
Then at run time we can specify the actual array size using the ReDim statement,as follows:
* 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
The String function has two arguments, a number and a single-character string, and returns a string consisting of the specified character repeated the speficified number of times. Follow the link below to read more.
Our Visual Basic 2017 tutorial is finally ready!
Start learning Visual Basic 2017 by clicking the link below: