I need to create an application which allows the user to figure out the area and perimeter by entering length and width of a rectangle. How would I start this.
Thanks in advance.
Printable View
I need to create an application which allows the user to figure out the area and perimeter by entering length and width of a rectangle. How would I start this.
Thanks in advance.
Dim int1 As Integer
Dim int2 As Integer
Dim intAnswer As Integer
lblarea.Caption = "Area"
lblper.Caption = "Perimetre"
int1 = txt1.Text
int2 = txt2.Text
this is what i have write down so far. txt1 and txt2 are the names of my two text boxes. What would the equation be.
Thread moved from the 'CodeBank VB6' forum (which is for you to post your code examples, not questions) to the 'VB6' forum
Chris
Start with doing it in "english"
If the 4 sides are (going clockwise) 4, 1, 4, 1, then..
what is the perimeter?
what is the area?
Then try to write that in code.
Does that help?
Spoo
Also What is the formula to calculate area and perimeter of a rectangle ;)? If you remember the formula then rest is easy :)
Sounds like the biggest problem here is that numbers and only numbers exist in the text boxes before you calculate the area and the perimeter of the rectangle.
Is that right? If not, then our nation's junior high schools and high schools are migrating back to the stone age.:ehh:
http://en.wikipedia.org/wiki/Rectangle
Guys you are making it sounds so complicated i learned it at school. It only took me 2 mins to do it.
This is what it looked liked
Dim int1 As Integer
Dim int2 As Integer
Dim intAnswer As Integer
int1 = txt1.Text
int2 = txt2.Text
intAnswer = int1 * 2 + int2 * 2
lblanswer.Caption = intAnswer
intAnswer2 = int1 * int2
lblanswer2.Caption = intAnswer2
Trust me, we knew how to do it too. It sounds like homework and we were not going to do it for you. You were asking for something that we all learned in grade school; and that can be interpretted 2 ways: 1) you were too lazy to write the code yourself, or 2) you honestly didn't know the equation which is why we suggested where you could find them.
Obviously you were able to write the code yourself.