It is easy to draw ellipse and circle in Visual Basic 2012. First of all, we need to create a Rectangle object. This rectangle serves as a bounding rectangle for the ellipse. Next, we use the DrawEllipse method to finish the job. On the other hand, we can also draw an ellipse with the DrawEllipse method without first creating a rectangle.
Visual Basic 2015 is now available! However, it comes as one of the components of Visual Studio 2015. You can preview and download Visual Studio 2015 from the link below:
Great News! I have just launched my Visual Basic 6 Made Easy book on Google Play. It is only selling for USD$6 during this promotional period. It is based on our Visual Basic tutorial but added great deal of additional stuff. Mobile phones and tablets can download the book on their mobile devices using the link below:
In our previous post, we have shown you the interface of the calculator and the code that can display numbers on the panel. In this article, we will delve into the code that makes calculator in visual basic 2013 works.
Let’s review the first part of code that displays numbers on the display panel when he user click on the number buttons.
Private Sub Btn1_Click(sender As Object, e As EventArgs) Handles Btn0.Click, Btn1.Click, Btn2.Click, Btn3.Click,
Btn4.Click, Btn5.Click, Btn6.Click, Btn7.Click, Btn8.Click, Btn9.Click
If LblPanel.Text = “0” Then LblPanel.Text = “”
LblPanel.Text += sender.text
To display numbers on the code, we just need to write one block of code for all the number buttons instead of one block of code for each and every button. The method is by using the sender object and by placing click event for all the buttons after the Handles keyword, separated by commas.
The meaning of sender As Object is the object that responses when the user clicks on a particular button. For example, if the user clicks on Btn2 number button, the sender is Btn2. The action is to display the text of the sender on the display panel, in this case it is 2 if the text on the display button is 0, otherwise the digit 2 will be placed in front of the previous digit.
We shall continue our discussion in next article….