Prep work: add 3 textboxes and 4 buttons
Button1 = Add
Button2 = Subtract
Button3 = Multiply
Button4 = Divide
Make sure to keep a textbox for the answer (I'll use one called, "TextBox3")
For Button 1:
TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.text)
'This takes text1's value and adds text2's value to it
For Button 2:
TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
'same as button one but subtract
For Button 3:
TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
For Button 4:
TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
Partial Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Private Sub InitializeComponent()
Me.txtDisplay = New System.Windows.Forms.TextBox
Me.btn0 = New System.Windows.Forms.Button
Me.btn2 = New System.Windows.Forms.Button
Me.btn3 = New System.Windows.Forms.Button
Me.btn1 = New System.Windows.Forms.Button
Me.btn4 = New System.Windows.Forms.Button
Me.btn5 = New System.Windows.Forms.Button
Me.btn6 = New System.Windows.Forms.Button
Me.btn9 = New System.Windows.Forms.Button
Me.btn8 = New System.Windows.Forms.Button
Me.btn7 = New System.Windows.Forms.Button
Me.btnDot = New System.Windows.Forms.Button
Me.btnEquals = New System.Windows.Forms.Button
Me.btnPlus = New System.Windows.Forms.Button
Me.btnMinus = New System.Windows.Forms.Button
Me.btnMultiply = New System.Windows.Forms.Button
Me.btnDivide = New System.Windows.Forms.Button
Me.btnMAdd = New System.Windows.Forms.Button
Me.btnMErase = New System.Windows.Forms.Button
Me.btnMRecall = New System.Windows.Forms.Button
Me.btnSquareRt = New System.Windows.Forms.Button
Me.btnPercent = New System.Windows.Forms.Button
Me.btnCE = New System.Windows.Forms.Button
Me.btnNegative = New System.Windows.Forms.Button
Me.txtSign = New System.Windows.Forms.TextBox
Me.txtAnswer = New System.Windows.Forms.TextBox
Me.txtDisplay2 = New System.Windows.Forms.TextBox
Me.SuspendLayout()
'
'txtDisplay
'
Me.txtDisplay.Location = New System.Drawing.Point(36, 117)
Me.txtDisplay.Name = "txtDisplay"
Me.txtDisplay.ReadOnly = True
Me.txtDisplay.Size = New System.Drawing.Size(372, 20)
Me.txtDisplay.TabIndex = 0
'
'btn0
'
Me.btn0.Location = New System.Drawing.Point(120, 350)
Me.btn0.Name = "btn0"
Me.btn0.Size = New System.Drawing.Size(36, 29)
Me.btn0.TabIndex = 0
Me.btn0.Text = "0"
Me.btn0.UseVisualStyleBackColor = True
'
'btn2
'
Me.btn2.Location = New System.Drawing.Point(162, 315)
Me.btn2.Name = "btn2"
Me.btn2.Size = New System.Drawing.Size(36, 29)
Me.btn2.TabIndex = 2
Me.btn2.Text = "2"
Me.btn2.UseVisualStyleBackColor = True
'
'btn3
'
Me.btn3.Location = New System.Drawing.Point(204, 315)
Me.btn3.Name = "btn3"
Me.btn3.Size = New System.Drawing.Size(36, 29)
Me.btn3.TabIndex = 3
Me.btn3.Text = "3"
Me.btn3.UseVisualStyleBackColor = True
'
'btn1
'
Me.btn1.Location = New System.Drawing.Point(120, 315)
Me.btn1.Name = "btn1"
Me.btn1.Size = New System.Drawing.Size(36, 29)
Me.btn1.TabIndex = 1
Me.btn1.Text = "1"
Me.btn1.UseVisualStyleBackColor = True
'
'btn4
'
Me.btn4.Location = New System.Drawing.Point(120, 280)
Me.btn4.Name = "btn4"
Me.btn4.Size = New System.Drawing.Size(36, 29)
Me.btn4.TabIndex = 4
Me.btn4.Text = "4"
Me.btn4.UseVisualStyleBackColor = True
'
'btn5
'
Me.btn5.Location = New System.Drawing.Point(162, 280)
Me.btn5.Name = "btn5"
Me.btn5.Size = New System.Drawing.Size(36, 29)
Me.btn5.TabIndex = 5
Me.btn5.Text = "5"
Me.btn5.UseVisualStyleBackColor = True
'
'btn6
'
Me.btn6.Location = New System.Drawing.Point(204, 280)
Me.btn6.Name = "btn6"
Me.btn6.Size = New System.Drawing.Size(36, 29)
Me.btn6.TabIndex = 6
Me.btn6.Text = "6"
Me.btn6.UseVisualStyleBackColor = True
'
'btn9
'
Me.btn9.Location = New System.Drawing.Point(204, 245)
Me.btn9.Name = "btn9"
Me.btn9.Size = New System.Drawing.Size(36, 29)
Me.btn9.TabIndex = 9
Me.btn9.Text = "9"
Me.btn9.UseVisualStyleBackColor = True
'
'btn8
'
Me.btn8.Location = New System.Drawing.Point(162, 245)
Me.btn8.Name = "btn8"
Me.btn8.Size = New System.Drawing.Size(36, 29)
Me.btn8.TabIndex = 8
Me.btn8.Text = "8"
Me.btn8.UseVisualStyleBackColor = True
'
'btn7
'
Me.btn7.Location = New System.Drawing.Point(120, 245)
Me.btn7.Name = "btn7"
Me.btn7.Size = New System.Drawing.Size(36, 29)
Me.btn7.TabIndex = 7
Me.btn7.Text = "7"
Me.btn7.UseVisualStyleBackColor = True
'
'btnDot
'
Me.btnDot.Location = New System.Drawing.Point(162, 350)
Me.btnDot.Name = "btnDot"
Me.btnDot.Size = New System.Drawing.Size(36, 29)
Me.btnDot.TabIndex = 10
Me.btnDot.Text = "."
Me.btnDot.UseVisualStyleBackColor = True
'
'btnEquals
'
Me.btnEquals.Location = New System.Drawing.Point(204, 350)
Me.btnEquals.Name = "btnEquals"
Me.btnEquals.Size = New System.Drawing.Size(36, 29)
Me.btnEquals.TabIndex = 11
Me.btnEquals.Text = "="
Me.btnEquals.UseVisualStyleBackColor = True
'
'btnPlus
'
Me.btnPlus.Location = New System.Drawing.Point(284, 315)
Me.btnPlus.Name = "btnPlus"
Me.btnPlus.Size = New System.Drawing.Size(36, 64)
Me.btnPlus.TabIndex = 12
Me.btnPlus.Text = "+"
Me.btnPlus.UseVisualStyleBackColor = True
'
'btnMinus
'
Me.btnMinus.Location = New System.Drawing.Point(284, 280)
Me.btnMinus.Name = "btnMinus"
Me.btnMinus.Size = New System.Drawing.Size(36, 29)
Me.btnMinus.TabIndex = 13
Me.btnMinus.Text = "-"
Me.btnMinus.UseVisualStyleBackColor = True
'
'btnMultiply
'
Me.btnMultiply.Location = New System.Drawing.Point(284, 245)
Me.btnMultiply.Name = "btnMultiply"
Me.btnMultiply.Size = New System.Drawing.Size(36, 29)
Me.btnMultiply.TabIndex = 14
Me.btnMultiply.Text = "*"
Me.btnMultiply.UseVisualStyleBackColor = True
'
'btnDivide
'
Me.btnDivide.Location = New System.Drawing.Point(284, 210)
Me.btnDivide.Name = "btnDivide"
Me.btnDivide.Size = New System.Drawing.Size(36, 29)
Me.btnDivide.TabIndex = 15
Me.btnDivide.Text = "/"
Me.btnDivide.UseVisualStyleBackColor = True
'
'btnMAdd
'
Me.btnMAdd.Location = New System.Drawing.Point(204, 210)
Me.btnMAdd.Name = "btnMAdd"
Me.btnMAdd.Size = New System.Drawing.Size(36, 29)
Me.btnMAdd.TabIndex = 16
Me.btnMAdd.Text = "M+"
Me.btnMAdd.UseVisualStyleBackColor = True
'
'btnMErase
'
Me.btnMErase.Location = New System.Drawing.Point(162, 210)
Me.btnMErase.Name = "btnMErase"
Me.btnMErase.Size = New System.Drawing.Size(36, 29)
Me.btnMErase.TabIndex = 17
Me.btnMErase.Text = "M-"
Me.btnMErase.UseVisualStyleBackColor = True
'
'btnMRecall
'
Me.btnMRecall.Location = New System.Drawing.Point(109, 210)
Me.btnMRecall.Name = "btnMRecall"
Me.btnMRecall.Size = New System.Drawing.Size(47, 29)
Me.btnMRecall.TabIndex = 18
Me.btnMRecall.Text = "MRC"
Me.btnMRecall.UseVisualStyleBackColor = True
'
'btnSquareRt
'
Me.btnSquareRt.Location = New System.Drawing.Point(204, 175)
Me.btnSquareRt.Name = "btnSquareRt"
Me.btnSquareRt.Size = New System.Drawing.Size(36, 29)
Me.btnSquareRt.TabIndex = 21
Me.btnSquareRt.Text = "√"
Me.btnSquareRt.UseVisualStyleBackColor = True
'
'btnPercent
'
Me.btnPercent.Location = New System.Drawing.Point(162, 175)
Me.btnPercent.Name = "btnPercent"
Me.btnPercent.Size = New System.Drawing.Size(36, 29)
Me.btnPercent.TabIndex = 20
Me.btnPercent.Text = "%"
Me.btnPercent.UseVisualStyleBackColor = True
'
'btnCE
'
Me.btnCE.Location = New System.Drawing.Point(109, 175)
Me.btnCE.Name = "btnCE"
Me.btnCE.Size = New System.Drawing.Size(47, 29)
Me.btnCE.TabIndex = 19
Me.btnCE.Text = "CE"
Me.btnCE.UseVisualStyleBackColor = True
'
'btnNegative
'
Me.btnNegative.Location = New System.Drawing.Point(284, 175)
Me.btnNegative.Name = "btnNegative"
Me.btnNegative.Size = New System.Drawing.Size(36, 29)
Me.btnNegative.TabIndex = 22
Me.btnNegative.Text = "+/-"
Me.btnNegative.UseVisualStyleBackColor = True
'
'txtSign
'
Me.txtSign.Location = New System.Drawing.Point(36, 91)
Me.txtSign.Name = "txtSign"
Me.txtSign.ReadOnly = True
Me.txtSign.Size = New System.Drawing.Size(372, 20)
Me.txtSign.TabIndex = 23
'
'txtAnswer
'
Me.txtAnswer.Location = New System.Drawing.Point(36, 12)
Me.txtAnswer.Name = "txtAnswer"
Me.txtAnswer.ReadOnly = True
Me.txtAnswer.Size = New System.Drawing.Size(372, 20)
Me.txtAnswer.TabIndex = 25
'
'txtDisplay2
'
Me.txtDisplay2.Location = New System.Drawing.Point(36, 65)
Me.txtDisplay2.Name = "txtDisplay2"
Me.txtDisplay2.ReadOnly = True
Me.txtDisplay2.Size = New System.Drawing.Size(372, 20)
Me.txtDisplay2.TabIndex = 26
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(436, 405)
Me.Controls.Add(Me.txtDisplay2)
Me.Controls.Add(Me.txtAnswer)
Me.Controls.Add(Me.txtSign)
Me.Controls.Add(Me.btnNegative)
Me.Controls.Add(Me.btnSquareRt)
Me.Controls.Add(Me.btnPercent)
Me.Controls.Add(Me.btnCE)
Me.Controls.Add(Me.btnMRecall)
Me.Controls.Add(Me.btnMErase)
Me.Controls.Add(Me.btnMAdd)
Me.Controls.Add(Me.btnDivide)
Me.Controls.Add(Me.btnMultiply)
Me.Controls.Add(Me.btnMinus)
Me.Controls.Add(Me.btnPlus)
Me.Controls.Add(Me.btnEquals)
Me.Controls.Add(Me.btnDot)
Me.Controls.Add(Me.btn9)
Me.Controls.Add(Me.btn8)
Me.Controls.Add(Me.btn7)
Me.Controls.Add(Me.btn6)
Me.Controls.Add(Me.btn5)
Me.Controls.Add(Me.btn4)
Me.Controls.Add(Me.btn1)
Me.Controls.Add(Me.btn3)
Me.Controls.Add(Me.btn2)
Me.Controls.Add(Me.btn0)
Me.Controls.Add(Me.txtDisplay)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents txtDisplay As System.Windows.Forms.TextBox
Friend WithEvents btn0 As System.Windows.Forms.Button
Friend WithEvents btn2 As System.Windows.Forms.Button
Friend WithEvents btn3 As System.Windows.Forms.Button
Friend WithEvents btn1 As System.Windows.Forms.Button
Friend WithEvents btn4 As System.Windows.Forms.Button
Friend WithEvents btn5 As System.Windows.Forms.Button
Friend WithEvents btn6 As System.Windows.Forms.Button
Friend WithEvents btn9 As System.Windows.Forms.Button
Friend WithEvents btn8 As System.Windows.Forms.Button
Friend WithEvents btn7 As System.Windows.Forms.Button
Friend WithEvents btnDot As System.Windows.Forms.Button
Friend WithEvents btnEquals As System.Windows.Forms.Button
Friend WithEvents btnPlus As System.Windows.Forms.Button
Friend WithEvents btnMinus As System.Windows.Forms.Button
Friend WithEvents btnMultiply As System.Windows.Forms.Button
Friend WithEvents btnDivide As System.Windows.Forms.Button
Friend WithEvents btnMAdd As System.Windows.Forms.Button
Friend WithEvents btnMErase As System.Windows.Forms.Button
Friend WithEvents btnMRecall As System.Windows.Forms.Button
Friend WithEvents btnSquareRt As System.Windows.Forms.Button
Friend WithEvents btnPercent As System.Windows.Forms.Button
Friend WithEvents btnCE As System.Windows.Forms.Button
Friend WithEvents btnNegative As System.Windows.Forms.Button
Friend WithEvents txtSign As System.Windows.Forms.TextBox
Friend WithEvents txtAnswer As System.Windows.Forms.TextBox
Friend WithEvents txtDisplay2 As System.Windows.Forms.TextBox
End Class
--------------------------------------------------------------------------
Code:
Public Class Form1
'Inherits System.Windows.Forms.Form
Dim Numbers() As Integer = New Integer(1) {total1, total2}
Dim total1 As Integer
Dim total2 As Integer
Dim sign As String
Dim total3 As Decimal
Dim read As Double
Private Sub btn0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn0.Click
If txtDisplay.Text = "" Then
txtDisplay.Text = ""
Else
txtDisplay.Text = txtDisplay.Text & "0"
End If
End Sub
Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click
txtDisplay.Text = txtDisplay.Text & "1"
End Sub
Private Sub btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click
txtDisplay.Text = txtDisplay.Text & "2"
End Sub
Private Sub btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn3.Click
txtDisplay.Text = txtDisplay.Text & "3"
End Sub
Private Sub btn4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn4.Click
txtDisplay.Text = txtDisplay.Text & "4"
End Sub
Private Sub btn5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn5.Click
txtDisplay.Text = txtDisplay.Text & "5"
End Sub
Private Sub btn6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn6.Click
txtDisplay.Text = txtDisplay.Text & "6"
End Sub
Private Sub btn7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn7.Click
txtDisplay.Text = txtDisplay.Text & "7"
End Sub
Private Sub btn8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn8.Click
txtDisplay.Text = txtDisplay.Text & "8"
End Sub
Private Sub btn9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn9.Click
txtDisplay.Text = txtDisplay.Text & "9"
End Sub
Private Sub btnDot_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDot.Click
If txtDisplay.Text = "." Then
txtDisplay.Text = total3
Else
txtDisplay.Text = txtDisplay.Text & "."
End If
btnDot.Enabled = False
End Sub
Private Sub btnPlus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlus.Click
total1 = txtDisplay.Text
sign = "+"
txtSign.Text = sign
MsgBox(total1)
MsgBox(total2)
End Sub
Private Sub btnMinus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMinus.Click
total1 = txtDisplay.Text
sign = "-"
txtSign.Text = sign
MsgBox(total1)
MsgBox(total2)
End Sub
Private Sub btnMultiply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMultiply.Click
total1 = txtDisplay.Text
sign = "*"
txtSign.Text = sign
MsgBox(total1)
MsgBox(total2)
End Sub
Private Sub btnDivide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDivide.Click
total1 = txtDisplay.Text
sign = "/"
txtSign.Text = sign
MsgBox(total1)
MsgBox(total2)
End Sub
Private Sub btnNegative_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNegative.Click
total1 = txtDisplay.Text
sign = "-"
txtSign.Text = sign
MsgBox(total1)
MsgBox(total2)
End Sub
End Class
Note : i am also learner if you know any other idea please mail me at me.binamra@gmail.com
VERSION 5.00
Begin VB.Form calculator
Caption = "Calculator"
ClientHeight = 5340
ClientLeft = 60
ClientTop = 450
ClientWidth = 6720
BeginProperty Font
Name = "Verdana"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 5340
ScaleWidth = 6720
StartUpPosition = 2 'CenterScreen
Begin VB.Frame Frame1
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 120
TabIndex = 35
Top = 4320
Width = 6495
Begin VB.Label Label1
Caption = "http://zsoftwares.googlepages.com/VBprograms.htm"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000040C0&
Height = 255
Left = 240
TabIndex = 36
Top = 360
Width = 6015
End
End
Begin VB.CommandButton onb
Caption = "On"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 1
Left = 3960
TabIndex = 34
Top = 1440
Width = 1095
End
Begin VB.CommandButton onb
Caption = "Off"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 0
Left = 3120
TabIndex = 33
Top = 1440
Width = 855
End
Begin VB.CommandButton Cmdcos
BackColor = &H0080C0FF&
Caption = "MS"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 11
Left = 1080
Style = 1 'Graphical
TabIndex = 32
Top = 1440
UseMaskColor = -1 'True
Width = 1935
End
Begin VB.CommandButton Cmdcos
BackColor = &H0080C0FF&
Caption = "MR"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 6
Left = 120
Style = 1 'Graphical
TabIndex = 31
Top = 1440
UseMaskColor = -1 'True
Width = 975
End
Begin VB.CommandButton Cmdcos
BackColor = &H0080C0FF&
Caption = "sqrt"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 10
Left = 1080
Style = 1 'Graphical
TabIndex = 30
Top = 2880
UseMaskColor = -1 'True
Width = 975
End
Begin VB.CommandButton Cmdcos
BackColor = &H0080C0FF&
Caption = "n!"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 3
Left = 1080
Style = 1 'Graphical
TabIndex = 29
Top = 3360
UseMaskColor = -1 'True
Width = 975
End
Begin VB.CommandButton Cmdcos
BackColor = &H0080C0FF&
Caption = "Exp"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 9
Left = 120
Style = 1 'Graphical
TabIndex = 28
Top = 2880
UseMaskColor = -1 'True
Width = 975
End
Begin VB.CommandButton Cmdcos
BackColor = &H0080C0FF&
Caption = "1/x"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 975
Index = 5
Left = 2040
Style = 1 'Graphical
TabIndex = 27
Top = 2880
UseMaskColor = -1 'True
Width = 975
End
Begin VB.CommandButton Cmdcos
BackColor = &H0080C0FF&
Caption = "ln"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 4
Left = 120
Style = 1 'Graphical
TabIndex = 26
Top = 3360
UseMaskColor = -1 'True
Width = 975
End
Begin VB.OptionButton Opt2
BackColor = &H00FFFFC0&
Caption = "Radian"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 255
Left = 1800
TabIndex = 25
Top = 1080
Width = 1095
End
Begin VB.OptionButton Opt1
BackColor = &H00FFFFC0&
Caption = "Degree"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 255
Left = 240
TabIndex = 24
Top = 1080
Width = 1215
End
Begin VB.CommandButton Cmdcos
BackColor = &H0080C0FF&
Caption = "x^2"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 8
Left = 1080
Style = 1 'Graphical
TabIndex = 23
Top = 2400
Width = 975
End
Begin VB.CommandButton Cmdcos
BackColor = &H0080C0FF&
Caption = "x^3"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 7
Left = 120
Style = 1 'Graphical
TabIndex = 22
Top = 2400
Width = 975
End
Begin VB.CommandButton Cmdop
BackColor = &H0080C0FF&
Caption = "x^y"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 4
Left = 2040
Style = 1 'Graphical
TabIndex = 21
Top = 2400
Width = 975
End
Begin VB.CommandButton Cmdcos
BackColor = &H0080C0FF&
Caption = "sin"
Enabled = 0 'False
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 2
Left = 120
Style = 1 'Graphical
TabIndex = 20
Top = 1920
UseMaskColor = -1 'True
Width = 975
End
Begin VB.CommandButton Cmdcos
BackColor = &H0080C0FF&
Caption = "tan"
Enabled = 0 'False
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 1
Left = 1080
Style = 1 'Graphical
TabIndex = 19
Top = 1920
UseMaskColor = -1 'True
Width = 975
End
Begin VB.CommandButton Cmdcos
BackColor = &H0080C0FF&
Caption = "cos"
Enabled = 0 'False
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 0
Left = 2040
Style = 1 'Graphical
TabIndex = 18
Top = 1920
UseMaskColor = -1 'True
Width = 975
End
Begin VB.CommandButton cmd
BackColor = &H8000000D&
Caption = "."
BeginProperty Font
Name = "Verdana"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 10
Left = 3120
Style = 1 'Graphical
TabIndex = 17
Top = 3360
Width = 855
End
Begin VB.CommandButton cmdc
Caption = "Clear"
BeginProperty Font
Name = "Verdana"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5040
Style = 1 'Graphical
TabIndex = 16
Top = 1440
Width = 1455
End
Begin VB.CommandButton Cmdop
BackColor = &H00C0FFC0&
Caption = "-"
BeginProperty Font
Name = "Verdana"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 3
Left = 5640
Style = 1 'Graphical
TabIndex = 15
Top = 3360
Width = 855
End
Begin VB.CommandButton Cmdop
BackColor = &H00C0FFC0&
Caption = "*"
BeginProperty Font
Name = "Verdana"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 2
Left = 5640
Style = 1 'Graphical
TabIndex = 14
Top = 2880
Width = 855
End
Begin VB.CommandButton Cmdop
BackColor = &H00C0FFC0&
Caption = "/"
BeginProperty Font
Name = "Verdana"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 1
Left = 5640
Style = 1 'Graphical
TabIndex = 13
Top = 1920
Width = 855
End
Begin VB.CommandButton Cmdop
BackColor = &H00C0FFC0&
Caption = "+"
BeginProperty Font
Name = "Verdana"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 0
Left = 5640
Style = 1 'Graphical
TabIndex = 12
Top = 2400
Width = 855
End
Begin VB.CommandButton cmde
BackColor = &H8000000D&
Caption = "="
BeginProperty Font
Name = "Verdana"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4800
Style = 1 'Graphical
TabIndex = 11
Top = 3360
Width = 855
End
Begin VB.CommandButton cmd
BackColor = &H8000000D&
Caption = "2"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 9
Left = 3960
Style = 1 'Graphical
TabIndex = 10
Top = 1920
Width = 855
End
Begin VB.CommandButton cmd
BackColor = &H8000000D&
Caption = "3"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 8
Left = 4800
Style = 1 'Graphical
TabIndex = 9
Top = 1920
Width = 855
End
Begin VB.CommandButton cmd
BackColor = &H8000000D&
Caption = "4"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 7
Left = 3120
Style = 1 'Graphical
TabIndex = 8
Top = 2400
Width = 855
End
Begin VB.CommandButton cmd
BackColor = &H8000000D&
Caption = "5"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 6
Left = 3960
Style = 1 'Graphical
TabIndex = 7
Top = 2400
Width = 855
End
Begin VB.CommandButton cmd
BackColor = &H8000000D&
Caption = "6"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 5
Left = 4800
Style = 1 'Graphical
TabIndex = 6
Top = 2400
Width = 855
End
Begin VB.CommandButton cmd
BackColor = &H8000000D&
Caption = "7"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 4
Left = 3120
Style = 1 'Graphical
TabIndex = 5
Top = 2880
Width = 855
End
Begin VB.CommandButton cmd
BackColor = &H8000000D&
Caption = "8"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 3
Left = 3960
Style = 1 'Graphical
TabIndex = 4
Top = 2880
Width = 855
End
Begin VB.CommandButton cmd
BackColor = &H8000000D&
Caption = "9"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 2
Left = 4800
Style = 1 'Graphical
TabIndex = 3
Top = 2880
Width = 855
End
Begin VB.CommandButton cmd
BackColor = &H8000000D&
Caption = "0"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 1
Left = 3960
Style = 1 'Graphical
TabIndex = 2
Top = 3360
Width = 855
End
Begin VB.CommandButton cmd
BackColor = &H8000000D&
Caption = "1"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 0
Left = 3120
MaskColor = &H00C0FFFF&
Style = 1 'Graphical
TabIndex = 1
Top = 1920
Width = 855
End
Begin VB.TextBox txt
Alignment = 1 'Right Justify
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 525
Left = 120
ScrollBars = 1 'Horizontal
TabIndex = 0
Text = "0"
Top = 240
Width = 6255
End
End
Attribute VB_Name = "calculator"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Dim no1 As Double, ans As Double, no2 As Double, NO3 As Double, cnt As Integer, cv As Integer, cnt1 As Integer
Dim op As String, op1 As String, flag As Integer, a As Double, x As Integer, nos As Integer
Private Declare Function ShellExecute Lib _
"shell32.dll" Alias "ShellExecuteA" _
(ByVal hWnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private SW_SHOWNORMAL
Private Sub cmd_Click(Index As Integer)
If txt.Text = "0" Then
txt.Text = ""
End If
If x = 0 Then
txt.Text = ""
x = x + 1
End If
txt.Text = txt.Text + cmd(Index).Caption
End Sub
Private Sub cmdc_Click()
txt.Text = "0"
cnt = 0
cnt1 = 0
j = 0
x = 0
End Sub
Private Sub cmdCos_Click(Index As Integer)
op1 = Cmdcos(Index).Caption
nos = txt.Text
Select Case op1
Case "cos"
If flag = 1 Then
ans = Cos((3.14 / 180) * nos)
Else
ans = Cos(nos)
End If
Case "sin"
If flag = 1 Then
ans = Sin((3.14 / 180) * nos)
Else
ans = Sin(nos)
End If
Case "tan"
If flag = 1 Then
ans = Tan((3.14 / 180) * nos)
Else
ans = Tan(nos)
End If
If no1 Mod 90 = 0 Then
NO3 = no1 / 2
If NO3 Mod 2 = 1 Then
i = MsgBox("Wrong input", vbExclamation + vbOKOnly, "ERROR")
ans = 0
Else
ans = 0
End If
End If
Case "x^2"
ans = nos ^ 2
Case "x^3"
ans = nos ^ 3
Case "1/x"
If nos = 0 Then
i = MsgBox("Divide by zero error", vbExclamation + vbOKOnly, "ERROR")
Else
ans = 1 / nos
End If
Case "ln"
If nos = 0 Then
i = MsgBox("Math error", vbExclamation + vbOKOnly, "ERROR")
Else
ans = Log(nos)
End If
Case "Exp"
ans = Exp(nos)
Case "n!"
ans = 1
no2 = nos
For i = 1 To no2
ans = ans * i
Next
Case "sqrt"
ans = Sqr(nos)
Case "MS"
ans = nos
a = nos
Case "MR"
ans = a
no1 = a
End Select
txt.Text = ans
End Sub
Private Sub cmde_Click()
cnt1 = 0
Select Case op
Case "+"
ans = txt.Text + no1
If cnt = 0 Then
no1 = txt.Text
cnt = cnt + 1
End If
txt.Text = ans
Case "-"
If cnt > 0 Then
txt.Text = no1
no1 = ans
End If
ans = no1 - txt.Text
no1 = txt.Text
txt.Text = ans
cnt = cnt + 1
Case "*"
ans = no1 * txt.Text
If cnt = 0 Then
no1 = txt.Text
cnt = cnt + 1
End If
txt.Text = ans
Case "/"
If cnt > 0 Then
txt.Text = no1
no1 = ans
End If
If txt.Text = "0" Then
i = MsgBox("Divide by zero error", vbExclamation + vbOKOnly, "ERROR")
Else
ans = no1 / txt.Text
no1 = txt.Text
txt.Text = ans
cnt = cnt + 1
End If
Case "x^y"
ans = no1 ^ txt.Text
txt.Text = ans
End Select
End Sub
Private Sub cmdop_Click(Index As Integer)
x = 0
If cnt1 > 0 Then
Select Case op
Case "+"
ans = no1 + txt.Text
txt.Text = ans
no1 = txt.Text
op = Cmdop(Index).Caption
Case "-"
ans = no1 - txt.Text
txt.Text = ans
no1 = txt.Text
op = Cmdop(Index).Caption
Case "/"
ans = no1 / txt.Text
txt.Text = ans
no1 = txt.Text
op = Cmdop(Index).Caption
Case "*"
ans = no1 * txt.Text
txt.Text = ans
no1 = txt.Text
op = Cmdop(Index).Caption
Case "x^y"
ans = no1 ^ txt.Text
txt.Text = ans
no1 = txt.Text
op = Cmdop(Index).Caption
End Select
Else
no1 = Val(txt.Text)
op = Cmdop(Index).Caption
txt.Text = 0
cnt1 = cnt1 + 1
End If
End Sub
Private Sub Form_Load()
flag = 0
cnt = 0
j = 0
i = 1
End Sub
Private Sub Label1_Click()
ShellExecute Me.hWnd, _
vbNullString, _
"http://zsoftwares.googlepages.com/VBprograms.htm", _
vbNullString, _
"c:", _
SW_SHOWNORMAL
End Sub
Private Sub onb_Click(Index As Integer)
If onb(Index).Caption = "On" Then
For i = 0 To 10
cmd(i).Enabled = True
Next
For i = 0 To 4
Cmdop(i).Enabled = True
Next
For i = 3 To 11
Cmdcos(i).Enabled = True
Next
cmde.Enabled = True
Opt1.Enabled = True
Opt2.Enabled = True
'col.BackColor = vbGreen
Else
For i = 0 To 10
cmd(i).Enabled = False
Next
For i = 0 To 4
Cmdop(i).Enabled = False
Next
flag = 0
For i = 0 To 11
Cmdcos(i).Enabled = False
Next
cmde.Enabled = False
Opt1.Enabled = False
Opt2.Enabled = False
Opt1.Value = False
Opt2.Value = False
' col.BackColor = vbRed
End If
End Sub
Private Sub Opt1_Click()
flag = 1
For i = 0 To 2
Cmdcos(i).Enabled = True
Next
End Sub
Private Sub Opt2_Click()
flag = 2
For i = 0 To 2
Cmdcos(i).Enabled = True
Next
End Sub
Source code for calculator in vb6.0?
855193
You can't integrate C++ source code directly into Visual Basic code. In order to make use of code written in another language, including C++, you must compile that source to produce a DLL. You can then link to that DLL via Visual Basic. The only caveat is that you must replace the C++ data types in the function declarations with the equivalent Visual Basic data types, such as 'Byte' for a C++ unsigned char, or 'Single' for a C++ float.
How could we know? You didn't post your code.
BASIC (Beginners All-purpose Symbolic Instruction Code) was developed by John Kemeny and Thomas Kurtz. Microsoft took BASIC and deveoped it into QuickBASIC, which was further developed into Visual Basic.
first you must have a visual basic if not how can make this?? jsut simply follow this code: end that's it.. thank you/..:) i hope i help..
Visual Basic code is a program or library that has been written using the Microsoft Visual Basic programming language.
What is the source code for scientific calculator in c?Read more: What_is_the_source_code_for_scientific_calculator_in_c
Basic in Visual Basic stands for Beginner's All-purpose Symbolic Instruction Code.
The syntax and operation is very similar, but visual basic isn't as powerful. Think of it as a watered down, easier version of c. With C, you can create anything from a simple calculator application to a full blown operating system. Visual basic can't make anything as extensive as an operating system, but it is much faster to code in visual basic when you want to make form based programs, or applications.
Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.Formulas can be written in cells. VBA code for Macros can be written by going into the Visual BASIC for Applications editor.
yes
In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.
Beginner's All-purpose Symbolic Instruction Code
855193
x ^ (1 / 3)
The code is: shell ("shutdown -s") That code should work for you.
Beginner's All-Purpose Symbollic Instruction Code