You can create a stock trading simulation program easily in Visual Basic. We will create such program using Visual Basic 6. Of course, you can also create the program using other versions of Visual Basic.
For stock trading, we need to consider the following data:
Asking Price- Price offered by the sellers
Bidding Price- Price offered by the buyers
Selling Quantity-Total number of shares available for sale on the stock market
Buying Quantity- Total number of shares the buyers bid on the stock market
Last Done Price- The price for the last transaction
Order Price – Price bid by the trader to buy or to sell
Order Quantity- Number of Shares ordered by the trader
Average Price- Average share price
Buy Value – Average value of shares paid by the trader
Gross Market Value- The current market of shares owned by the trader
The total number of shares in the hand of the trader.
Read more by following the link below:
Stock Trading Simulation Program
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.