Results 1 to 11 of 11

Thread: Need with a math application

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2010
    Posts
    55

    Need with a math application

    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.

  2. #2

    Thread Starter
    Member
    Join Date
    Feb 2010
    Posts
    55

    Re: Need with a math application

    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.

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Need with a math application

    Thread moved from the 'CodeBank VB6' forum (which is for you to post your code examples, not questions) to the 'VB6' forum

  4. #4
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Need with a math application

    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

  5. #5
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Need with a math application

    Also What is the formula to calculate area and perimeter of a rectangle ? If you remember the formula then rest is easy
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  6. #6
    PowerPoster Code Doc's Avatar
    Join Date
    Mar 2007
    Location
    Omaha, Nebraska
    Posts
    2,354

    Re: Need with a math application

    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.

    http://en.wikipedia.org/wiki/Rectangle
    Last edited by Code Doc; Mar 10th, 2010 at 07:56 PM.
    Doctor Ed

  7. #7
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Need with a math application

    Quote Originally Posted by chrisman10 View Post
    ...this is what i have write down so far... What would the equation be.
    A simple google for perimeter area rectangle will define the formulas you want and give plenty of examples. Gotta be only 2 minutes effort at most.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  8. #8

    Thread Starter
    Member
    Join Date
    Feb 2010
    Posts
    55

    Re: Need with a math application

    Guys you are making it sounds so complicated i learned it at school. It only took me 2 mins to do it.

  9. #9

    Thread Starter
    Member
    Join Date
    Feb 2010
    Posts
    55

    Re: Need with a math application

    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

  10. #10
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Need with a math application

    Quote Originally Posted by chrisman10 View Post
    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
    So that your code is easier for others to read wrap [highlight="vb"][/highlight] tags around it.
    Last edited by Nightwalker83; Mar 13th, 2010 at 10:09 PM. Reason: Fixed spelling!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  11. #11
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Need with a math application

    Quote Originally Posted by chrisman10 View Post
    Guys you are making it sounds so complicated i learned it at school. It only took me 2 mins to do it.
    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width