Results 1 to 5 of 5

Thread: A simple Claculator in Vb6.0

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2004
    Posts
    1

    A simple Claculator in Vb6.0

    I just recently began programming and really havent learned much about it yet however i am studing it. I am working with a friend to make a type of toolkit for a game and i was asked to make a simple calculator. I have the form created and some code written but the only thing i cannot figure out is with buttons such as add and subtract would i need to state them as being something? If so could someone please point me to the right direction and not really naming anything but like an article i could read to sort of figure things out?
    Thank you for the help

    Weltall 2

  2. #2
    Banned jhermiz's Avatar
    Join Date
    Jun 2002
    Location
    Antarctica
    Posts
    2,492

    Re: A simple Claculator in Vb6.0

    Originally posted by weltall 2
    I just recently began programming and really havent learned much about it yet however i am studing it. I am working with a friend to make a type of toolkit for a game and i was asked to make a simple calculator. I have the form created and some code written but the only thing i cannot figure out is with buttons such as add and subtract would i need to state them as being something? If so could someone please point me to the right direction and not really naming anything but like an article i could read to sort of figure things out?
    Thank you for the help

    Weltall 2


    cmdAdd_Click:

    Me.txtResult=Me.txtResult+someValue

    'textResult is the main display should be initialized to 0.

    cmdSub_Click:

    Me.txtResult=Me.txtResult-someValue

    etc etc...

    You may need to use the CLng() function if you're dealing with other expressions..etc.


  3. #3
    Hyperactive Member
    Join Date
    May 2003
    Posts
    401
    Here is a Link for a simple calculator example in vb to get you started.
    Enjoy!!!
    apps_tech

  4. #4
    New Member
    Join Date
    Jul 2004
    Location
    Colchester, Uk
    Posts
    12
    i recommend, if your learning to program a calculator, you read up on arrays. if you havent already. each element of your calculation should be done through arrays, its easier than calculating the sum after each operator. plus keep BODMAS in mind as your calculations will be inaccurate otherwise.

  5. #5
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,238
    Here is the sample calculator that comes with VB6 samples from the MSDN disc's.
    Attached Files Attached Files

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