Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 132,303 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,032 people online right now. Registration is fast and FREE... Join Now!




calculator

 
Reply to this topicStart new topic

calculator

romnicksanchez
post 1 Oct, 2008 - 06:24 PM
Post #1


New D.I.C Head

*
Joined: 1 Oct, 2008
Posts: 1

i want a sample of vb program calculator
User is offlineProfile CardPM

Go to the top of the page

akhileshbc
post 1 Oct, 2008 - 06:47 PM
Post #2


D.I.C Head

Group Icon
Joined: 26 Sep, 2008
Posts: 177



Thanked 3 times

Dream Kudos: 50
My Contributions


Search planetsourcecode.Com for code
User is offlineProfile CardPM

Go to the top of the page

jaakko
post 5 Oct, 2008 - 11:11 AM
Post #3


New D.I.C Head

*
Joined: 26 Sep, 2008
Posts: 21



Thanked 1 times
My Contributions


QUOTE(romnicksanchez @ 1 Oct, 2008 - 07:24 PM) *

i want a sample of vb program calculator


If you want to make the program yourself, start by designing your calculator in a form. The display can be a textbox and the buttons can be buttons. The important point is that you make the buttons an array of ten buttons. The first button is number 0, second 1 and so on. Thus you only need to write the handling of the buttons once. If you did not know this and are interested then return to the subject after having done this.
User is offlineProfile CardPM

Go to the top of the page

visualbasic_king101
post 10 Oct, 2008 - 01:47 AM
Post #4


New D.I.C Head

*
Joined: 3 Oct, 2008
Posts: 2

+1
User is offlineProfile CardPM

Go to the top of the page

dmcollette664
post 12 Oct, 2008 - 03:47 AM
Post #5


New D.I.C Head

*
Joined: 13 Sep, 2008
Posts: 13

QUOTE(romnicksanchez @ 1 Oct, 2008 - 07:24 PM) *

i want a sample of vb program calculator



Hi,

Just learning Vbscript myself. This calulation program is pretty much straight from the book. Hope it's what you are looking for.


CODE

'*************************************************************************
'Script Name: Mathgame.vbs
'Author: Jerry Ford
'Created: 02/28/02
'Modified by:
'Modified date: 9/10/2008
'Mathmatical equation changed
'Description: This script prompts the user to solve a mathematical
'expression and demonstrates how to solve it in the event that the user
'cannot
'*************************************************************************

'Initialization Section

Option Explicit

Dim WshShl, QuestionOne, Proveit

'Define the title bar message to be displayed in the script's
'pop-up dialog
Const cTitlebarMsg = "The Math Game"

'Instantiate an instance of the WshShell object
Set WshShl = WScript.CreateObject("WScript.Shell")

'Present the player with the equation
QuestionOne = InputBox("What is the sum of 3 + 7 * 8 / 4 ?", cTitlebarMsg)

'See if the player provided an answer
If Len(QuestionOne) = 0 Then
  MsgBox "Sorry. You must enter a number to play this game."
  WScript.Quit
End If

'Make sure that the player typed a number
If IsNumeric(QuestionOne) <> True Then
  MsgBox "Sorry. You must enter a number to play this game."
  WScript.Quit
End If

'Check to see if the player provided the correct answer  
If QuestionOne = 17 Then
  MsgBox "Correct! You obviously know your math!"
Else
  ProveIt = MsgBox("Incorrect. Do you want to see me solve the " & _
  "equation?", 36, cTitlebarMsg)

  If ProveIt = 6 Then 'Player wants to see the solution
  
    'Start the WordPad application
    WshShl.Run "WordPad"

    'Pause script execution to give Windows enough time to load WordPad
    WScript.Sleep 2000

    'Use WordPad to show the player how to solve the equation

    WshShl.SendKeys "To answer this question you must follow the " & _
      "correct order of precedence when performing your calculations."

    WScript.Sleep 2000
    WshShl.SendKeys "~~"
    WshShl.SendKeys "1st, working from left to right multiply 7 * 8."
    WScript.Sleep 2000
    WshShl.SendKeys "~~"
    WshShl.SendKeys "2nd, divide the result by 4."
    WScript.Sleep 2000
    WshShl.SendKeys "~~"
    WshShl.SendKeys "3rd, add 3."
    WScript.Sleep 2000
    WshShl.SendKeys "~~"
    WshShl.SendKeys "The final answer is 17."
    WScript.Sleep 2000
    WshShl.SendKeys "~~"
    WshShl.SendKeys "~~"
    WshShl.SendKeys "In case you question my math..... watch this!"
    WScript.Sleep 2000
    WshShl.SendKeys "%{F4}"
    WshShl.SendKeys "%{N}"

    'Start the Calculator application
    WshShl.Run "Calc"

    'Use the Calculator application to solve the equation
    WScript.Sleep 2000
    WshShl.SendKeys 7 & "{*}"
    WScript.Sleep 2000
    WshShl.SendKeys 8
    WScript.Sleep 2000
    WshShl.SendKeys "~"
    WScript.Sleep 2000
    WshShl.SendKeys "{/}" & 4
    WScript.Sleep 2000
    WshShl.SendKeys "~"
    WScript.Sleep 2000
    WshShl.SendKeys "{+}" & 3
    WScript.Sleep 2000
    WshShl.SendKeys "~"
    WScript.Sleep 2000
    WshShl.SendKeys "%{F4}"
  End If
End If
User is offlineProfile CardPM

Go to the top of the page

yoyoboy38
post 13 Oct, 2008 - 11:15 PM
Post #6


New D.I.C Head

*
Joined: 13 Oct, 2008
Posts: 5


My Contributions


QUOTE(romnicksanchez @ 1 Oct, 2008 - 07:24 PM) *

i want a sample of vb program calculator


Creating a simple calculator program in VB is quite easy. I have explained it in my visual basic tutorial site. Follow my signature and find what you want.

Or I have attached the simple calculator program designed in VB in this thread. You can download it and enjoy it.

If possible reply to this post with your feedback.

Attached File  calculator.zip ( 2.21k ) Number of downloads: 16
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/22/08 02:01AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month