Creating a graphical dice using Visual Basic 2010

We have learned how to create a digital dice using Visual Basic 2010 in Visual Basic 2010 Tutorial Lesson 27. Now we wish to create a graphical dice which resembles the real dice instead.

Writing the code to create a graphical dice in Visual Basic 2010 is slightly different from the code in VB6. In VB6, we used the shape control to draw the dots. However, in Visual Basic 2010, there is no built-in shape tool so we use images instead. Therefore, the first step in creating a graphical dice in Visual Basic 2010 is to create six images, each denote one of the faces of the dice. Next, you write a code that load the images randomly, it is that simple.

View the code here.

 

 

 

 

Creating Simple Harmonic Motion Simulator in Visual Basic 6

Simple harmonic motion is the motion of a simple harmonic oscillator. The motion is periodic, as it repeats itself at standard intervals in a specific manner with constant amplitude. It is characterized by its amplitude , its period which is the time for a single oscillation, its frequency which is the number of cycles per unit time, and its phase, which determines the starting point on the sine wave. The period, and its inverse the frequency, are constants determined by the overall system, while the amplitude and phase are determined by the initial conditions (position and velocity) of that system. (Wikipedia, 2008).

The general equation describing simple harmonic motion is
x=Acos(2pft+f), where x is the displacement, A is the amplitude of the oscillation, f is the frequency, t is the elapsed time and f is the phase of oscillation.

To create a simple model of simple harmonic motion in Visual Basic , we used the equation x=Acos(wt), and we have assigned a value of 500 to A and a value of 50 to w. In this program, the circular object which we have inserted into the form will oscillate from left to right and vice versa, reaching the maximum speed at the middle of the path.

Learn how to write the code for SHM by following the link below:

http://www.vbtutor.net/VB_Sample/shm.htm

Understanding Math Functions in Visual Basic 2012

In Visual Basic 2012 , we can write code to perform arithmetic operations using standard mathematical operators. However, for more complex mathematical calculations, we need to use the built-in math functions in Visual Basic 2012. There are numerous built-in mathematical functions in VB 2012 which we introduced them one by one in lesson 14. The syntax of Math functions in Visual Basic 2012 is

Math.Function(argument)

For example, the Abs function returns the absolute value of a number. The syntax is:

Math. Abs (number)

* The Math keyword here indicates that the function belong to the Math class. However, not all mathematical functions belong to the Math class.

Read more about using Math functions in Visual Basic 2012 lesson 14

Creating a Scientific Calculator in Visual Basic 6

We can create a calculator that resembles a typical scientific calculator , albeit a simpler version. In our version, we have only included the trigonometric functions and the logarithmic functions. The reason of creating a simpler version of the calculator is to help users to learn the programming concepts in a gradual manner and not to confuse them especially those who are learning to program in Visual Basic.

To design the interface, we just to need to modify the interface of the basic calculator that we have created earlier using Visual Basic 6. In this calculator, we have added five more buttons, they are Sin, Cos, Tan, Log and Ln. The common trigonometric functions in Visual Basic 6 are Sin, Cos, Tan and Atn.

Learn more about the scientific calculator by following the link below:

http://www.vbtutor.net/index.php/scientific-calculator-created-using-visual-basic-6/

Creating a Scientific Calculator in Visual Basic

In Visual Basic 6, we can create a scientific calculator that resembles a typical scientific calculator albeit a simpler version. Other than the number buttons, the operator buttons and some additional buttons such as the memory button and the clear button, we have added all three trigonometric functions and the log functions.

The interface is shown below:
Cal_Sctific

I want you to try writing code for this calculator and I will show you the full code later.