MR, MC, MS, M+, M- in calculator
Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
4 posts
Page 1 of 1
I know that this isn't new. a lot of post like this already
but here, this includes MEMORY FUNCTION IN CALCULATOR, square root, percent,
receprocal, square of a number and cube of a number.
this also includes a SOUND produced in every click made in buttons,
Formulas, Theme used for the form( from gambino) and a round buttons.
For details, please have a look on the project file(download link provided)
IMPORTANT:
alt 251 = for squareroot
alt 241 =for plusminus sign
MR =means ' recall memory and desplay in textbox
MC =means' delete the number in memory
MS =means ' store the current number from textbox to the memory
M+ = means add the current number from textbox to the number in memory
M- =means' deduct the current number from textbox to the number in memory
LINK for the project: http://www.mediafire.com/?sb0sfoysx9bb6wv
but here, this includes MEMORY FUNCTION IN CALCULATOR, square root, percent,
receprocal, square of a number and cube of a number.
this also includes a SOUND produced in every click made in buttons,
Formulas, Theme used for the form( from gambino) and a round buttons.
For details, please have a look on the project file(download link provided)
IMPORTANT:
alt 251 = for squareroot
alt 241 =for plusminus sign
MR =means ' recall memory and desplay in textbox
MC =means' delete the number in memory
MS =means ' store the current number from textbox to the memory
M+ = means add the current number from textbox to the number in memory
M- =means' deduct the current number from textbox to the number in memory
Code: Select all
Public Class Form1
Dim firstnumber As String
Dim operation As String
Dim secondnumber As String
Dim result As String
Private Sub bcancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bcancel.Click
'=======clear the textbox=======
LCD.Text = "0"
firstnumber = Nothing
secondnumber = Nothing
End Sub
Private Sub operate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles badd.Click, bsub.Click, bmult.Click, bdev.Click
'=======determines the operation used (+-/x)=====
firstnumber = LCD.Text
LCD.Text = 0
operation = sender.text
End Sub
Private Sub bequal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bequal.Click
'==========display the result===========
If operation = "+" Then
secondnumber = LCD.Text
result = Val(firstnumber) + Val(secondnumber)
LCD.Text = result
secondnumber = Nothing
firstnumber = Nothing
End If
If operation = "-" Then
secondnumber = LCD.Text
result = firstnumber - secondnumber
LCD.Text = result
secondnumber = Nothing
firstnumber = Nothing
End If
If operation = "x" Then
secondnumber = LCD.Text
result = firstnumber * secondnumber
LCD.Text = result
secondnumber = Nothing
firstnumber = Nothing
End If
If operation = "/" Then
secondnumber = LCD.Text
result = firstnumber / secondnumber
LCD.Text = result
secondnumber = Nothing
firstnumber = Nothing
End If
My.Computer.Audio.Play( _
My.Resources.Windows_Navigation_Start, _
AudioPlayMode.Background)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'============enable / disable the equals button===============
If Not firstnumber = Nothing And Not LCD.Text = "0" Then
bequal.Enabled = True
Else
bequal.Enabled = False
End If
End Sub
Private Sub Newcalculator_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
'=========remember the number saved in memory=============
If Not My.Settings.memorycal = Nothing Then
My.Settings.Save()
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Start()
End Sub
Private Sub Bbackspace_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bbackspace.Click
'==========remove the last number in text box===================
If Not LCD.TextLength < 1 Then
LCD.Text = LCD.Text.Remove(LCD.Text.Length - 1)
End If
If LCD.TextLength = 0 Then
LCD.Text = 0
End If
End Sub
Private Sub Bperiod_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bperiod.Click
If LCD.Text.Contains(".") = True Then
LCD.Text = LCD.Text
Else
LCD.Text = LCD.Text & "."
End If
End Sub
Private Sub Bpercent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bpercent.Click
'==================calculate percentage================
If Not firstnumber = Nothing And Not LCD.Text = "0" Then
bequal.Enabled = False
secondnumber = LCD.Text
LCD.Text = firstnumber * (secondnumber / 100)
secondnumber = Nothing
firstnumber = Nothing
End If
End Sub
Private Sub Breceprocal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Breceprocal.Click
'==============get the receprocal of a number==============
firstnumber = LCD.Text
bequal.Enabled = False
LCD.Text = 1 / firstnumber
secondnumber = Nothing
firstnumber = Nothing
End Sub
Private Sub Bsquareroot_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bsquareroot.Click
'=========get the square root of a number================
If Not LCD.Text = Nothing Then
firstnumber = LCD.Text
LCD.Text = System.Math.Sqrt((firstnumber))
firstnumber = Nothing
End If
End Sub
Private Sub Bplusminus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bplusminus.Click
'=============change the number to positive or negative===========
If Not LCD.Text = 0 Then
LCD.Text = -LCD.Text
Else
LCD.Text = Not (-LCD.Text)
End If
End Sub
Private Sub BCE_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BCE.Click
LCD.Text = "0"
secondnumber = Nothing
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bdouble.Click
'=================get the square value of a number==========
If Not LCD.Text = Nothing Then
firstnumber = LCD.Text
LCD.Text = firstnumber * firstnumber
firstnumber = Nothing
End If
End Sub
Private Sub Btriple_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btriple.Click
'=========get the cube value of a number=============================
If Not LCD.Text = Nothing Then
firstnumber = LCD.Text
LCD.Text = firstnumber * firstnumber * firstnumber
firstnumber = Nothing
End If
End Sub
Private Sub BMplus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BMplus.Click
'=======add the current number to the number in memory============
My.Settings.memorycal = Val(My.Settings.memorycal) + LCD.Text
LCD.Text = "0"
End Sub
Private Sub BMR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BMR.Click
'================this recall the number saved in memory============
If Not My.Settings.memorycal = Nothing Then
LCD.Text = My.Settings.memorycal
Else
LCD.Text = "0"
End If
End Sub
Private Sub BMS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BMS.Click
'===========display the number from memory in textbox==============
My.Settings.memorycal = LCD.Text
End Sub
Private Sub BMC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BMC.Click
'=========delete the number in memory=========================
My.Settings.memorycal = Nothing
End Sub
Private Sub BMminus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BMminus.Click
'==============subtract the number in memory by the number in textbox========
My.Settings.memorycal = Val(My.Settings.memorycal) - LCD.Text
LCD.Text = "0"
End Sub
Private Sub button_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles N0.Click, N1.Click, N2.Click, N3.Click, N4.Click, N5.Click, N6.Click, N7.Click, N8.Click, N9.Click
'=======this send the number pressed to the textbox, where 'N' is a button with number from 0 to 9=============
If LCD.Text = "0" Then
LCD.Text = sender.text
Else
LCD.Text = LCD.Text & sender.text
End If
My.Computer.Audio.Play( My.Resources.Windows_Navigation_Start, AudioPlayMode.Background)
'=====Windows_Navigation_Start - is the name of the wave file saved in resources -every time you press a button it makes a click sound
End Sub
End Class
LINK for the project: http://www.mediafire.com/?sb0sfoysx9bb6wv
You do not have the required permissions to view the files attached to this post.
this is a freaking cool , very nice tut well explained and the GUI is superb by the way 0 the borders of buttons to make it look more good
Find my programs on Softpedia
@ mshimranpro... yes the border should be zero and the style is flat
check the code below.... it change the flat style to pop -up in buttons when mouse hover into it
this code handles multiple buttons
check the code below.... it change the flat style to pop -up in buttons when mouse hover into it
this code handles multiple buttons
Code: Select all
'HANDLES MOUSE EVENTS WHEN MOUSE MOVES OVER A BUTTON
Private Sub but_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.MouseEnter, Button2.MouseEnter, Button3.MouseEnter, Button4.MouseEnter
CType(sender, Button).FlatStyle = FlatStyle.Popup
End Sub
Private Sub but_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.MouseLeave, Button2.MouseLeave, Button4.MouseLeave, Button3.MouseLeave
CType(sender, Button).FlatStyle = FlatStyle.Flat
CType(sender, Button).FlatAppearance.BorderSize = 0
End Sub
wow i didn't see this before
nice work
nice work

visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
4 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023