 |
 |
 |
 |
| Right all seems to fine with this, aslong as you understand how to set up the gui so you are creating an array of command buttons and putting 0-9 on them, and some others for *,/,-,+ then all is ok, just to mention even though with this calculator it is not possible first = txtDisplay.Text i would have changed to first = Val(txtDisplay.Text), just out of practice, anyway. If you still need help I'll provide some.
Sarkie |
|
 |
| | Ah, blatant plagiarism... where would we be without it? |
|
 |
| |
 |
| | Well, my codes for the cal go different and i am stuck up with, its not taking the second digit into display. Help me out....... |
|
 |
| | Try F5ing the code..a nd post the lines that seem to be giving errors. |
|
 |
| | if you not getting anything to display check the index, it should be blank for Clear,Equal and dot. Also 0-9 should all be Command1 but they should have a ranging index that also goes from 0-9. The same goes for (+)(-)(/)(*) They should all be named Command2 and have a ranging index of 0-3. Things will mess up if somthing insn't an array and the index is somthing other then blank. I Hope this clear things up for anyone that has or will look at this post. because the Author failed to throughly explain such things. |
|
 |
| Whats funny about that fellow is it seems everyone younger than 18-19 is using that type of language, examiners have even had to go on several courses to understand the "New-age language" as it is now submissible in exams.
Personally i hate such abbreviations and put it down to sheer lazyness, ok on a mobile-phone where you have limited space i guess its ok, but on paper/e-mails whats the point? i proved this to my sister not long back i typed normal english she typed her txt-slang and i still managed to finish before her, it doesn't look cool and its not easier.
Granted, i make spelling mistakes lol
Ref:
http://www.bbc.co.uk/voices/yourvoice/language_rules1.shtml
http://www.bbc.co.uk/wales/northeast/sites/your_shout/pages/txt.shtml
http://scotlandonsunday.scotsman.com/index.cfm?id=350682003 |
|
 |
| Well I'm fifteen and though English is not my mother tongue, I greatly digress with such way of using the English language. Not everyone speaks that way; perhaps only those who are stupid enough to think that they're cool if they could speak that way.
Anyway, I've had the bad luck of having to create a VB Calculator. Thanks for the article.
(The previous comments actually made me laugh.) |
|
 |
| | Thanks very much for this tutorial but theres just one problem. Im using Visual Basic 2003 and the thing is, after I create and copy all the buttons, No message box appears asking me to create an array? Whats the solution to this? Or is that feature not supported in VB 2003. What other way is there. Thanks |
|
 |
| This tutorial really helped me a lot.....i've done a simple calculator by my means, and toke some ideas from this...
but i've used 4 "dims" :p in my calculator..... another one for the result ;) more simple for me.... |
|
 |
| | Anyone? How to make an array manually? Again, I copied the buttons but still no response. And what names did you asign to them? |
|
 |
| sub btnOne_Click(ByVal whatever, and ever, not important)
txtBox.text = appendtext(cstr("1")
'um that skips alot of stuff you just did...
'just convert text later
'oh and i think this only works for 05 |
|
 |
| can any1 help me with inserting a percentage button on visual basic working in the followin way??
enter a number
press the * button
enter the 'percent' of number
press the % button |
|
 |
| I'm not pretty sure how to do this, but why not add:
If keycode = vbKeyA then
End If
It should be used to make it possible to press the +,-,* or / to put it out in the textfield.
I think the ASCII numbers for the keys must be used. Cause it didn't work with + for me to end a program.... |
|
 |
| To the person whoz equal is not working... Did you include Val at the front of your integer values?? eg. Sum= Val(Numkey1)+Val(Numkey2)
This calls the integer values of the text field to be added and not the string. |
|
 |
| Great work. It took a fair bit of studying for a beginer in VB such as myself, but I finally realised what I was doing wrong and it's now exactly what I hoped for! :D thank you for giving me the base to my calculator.
Now I have much work to do in adding to it :) Thanks again! |
|
 |
| | this is not a very good example of a calculator, for one you can only operate on two numbers, secondly there is no error catching for when someone was to press an operator button twice... and there should be better description on what command button 1 and command button 2 actually refer too. designing the program is just as important as coding the program! please keep this in mind, especially when dealing with VB |
|
 |
| | i dont see the point of the txtDisplay.MaxLength = 10 , try entering in 999999999 and then add with any number, see what happens..... |
|
 |
| | Perhaps you should tell which version of VB you are using, it would make it easier to know if it definetely will work for the one you have, or if perhaps I have an other version, because it doesnt seem to work when I type your coding in. Only get error every fking where. |
|
 |
| | I couldn't get this to work, my version of visual basic doesn't prompt me about arrays when I create the buttons. Now the debugger says "index" is not declaired. This script is incomplete. |
|
 |
| Private Sub btnSquareRoot_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSquareRoot.Click
If txtDisplay.Text.Length <> 0 Then
tmpValue = CDbl(txtDisplay.Text)
tmpValue = System.Math.Sqrt(tmpValue)
txtDisplay.Text = CStr(tmpValue)
End If
End Sub
thats for SquareRoot... but i need Percentage =.= |
|
 |
| |
 |
| ur code is not proper.
aftre clicking on the add button,it will show addition of second no only,and the first one is ignored.
i.e. if we click on 1+2,it will show 4 i.e. 2+2
kindly give the reply within 10 minutes. |
|
 |
| | I would like to ask whether anyone knows visual basic6.0. If you do could you email me a calculator code with on vb6.0 . Only on the simply operands like +'-'* and /. PLEASE send me one .I have failed to make mine run 3times in a row now. |
|
 |
| i am a begginer in vb and it is difficult to me to understand the codes.. vb is a gui but when i started to generate the codes, it is very tricky and i dont know where to put the codes... it has a churveness of private and piblic! i cant understand... any one can help me coz my supervisor told me that i should be familiarize with vb but unfortunately we did not discuss that language in our school..
anyone can help me plsss..
im looking forward for the person who have a kind hearted to help me!!
kindly email me at flores.cynthia.29@gmail.com
im starting reading and browsing the net about vb tutorial etc... thanks a lot and have a nice day ahead to all of you...
mmmmmmwwwwwwaaaaaaaaaahhhhhhhhhhh!!!!!!! |
|
 |
| Thanks alot man! that was really Helpfull in our Collage Project!!! I really appreciate Your Help!!!!!!
Thanks a bunch!! |
|
 |
| | if it still doesn't work then try pressing F6 at the same time as Ctrl-HUMP. That will make it work. if HUM P does not work try Atl-balls |
|
 |
| | thanks for the creator codes in java thank3X |
|
 |
| | i want to create a calculater in VB how to implemente.plese help me.asif |
|
 |
| | does anyone have a code for the percent button |
|
 |
| | i dnt know how to work with the array thing can any1 help? i use vb6 |
|
 |
| | when i calculating with two numbers it give me a error message tat "argument not optional" and the "second ="(in the 'Private sub cmdEq_click()') is selected.what is the problem..... |
|
 |
| | nt a proper code n cmpletely difficlt 2 follow |
|
 |
| | jus one thing man i have copied the entire thing made boxes as u said an even done that array thing though i don't know wha it is an still it doesn't display ny result |
|
 |
| These comments make me laugh. If you are having trouble, why not ask on a forum or somewhere where somebody will actually reply?
Try looking back over the code for obvious mistakes kids. |
|
 |
| | thanks for sucha a good article. I followed all the code the only thing I didn't undrestan was "command1 and command2". command1(index) and command2(index). Do I have to 'dim' them or ... could someone please answer, I will greatly appreciate |
|
 |
| Public Class Form1
Dim s = 0, a As Integer
Dim op As String
Dim b As String
Dim c As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
a = 1
TextBox1.Text = "1"
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
a = 2
TextBox1.Text = "2"
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
a = 3
TextBox1.Text = "3"
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
a = 4
TextBox1.Text = "4"
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
a = 5
TextBox1.Text = "5"
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
a = 6
TextBox1.Text = "6"
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
a = 7
TextBox1.Text = "7"
End Sub
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
a = 8
TextBox1.Text = "8"
End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
a = 9
TextBox1.Text = "9"
End Sub
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
a = 0
TextBox1.Text = "0"
End Sub
Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
s = Integer.Parse(TextBox1.Text)
op = "+"
TextBox1.Text = ""
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
s = 0
a = 0
TextBox1.Text = a.ToString()
End Sub
Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
s = Integer.Parse(TextBox1.Text)
op = "-"
TextBox1.Text = ""
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If op = "+" Then
s = s + Integer.Parse(TextBox1.Text)
End If
If op = "-" Then
s = s - Integer.Parse(TextBox1.Text)
End If
If b = "*" Then
s = s * Integer.Parse(TextBox1.Text)
End If
TextBox1.Text = "0"
TextBox1.Text = s.ToString()
s = 0
End Sub
Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
s = Integer.Parse(TextBox1.Text)
b = "*"
End Sub
Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
s = Integer.Parse(TextBox1.Text)
c = "/"
TextBox1.Text = ""
End Sub
End Class
|
|
 |
| |
 |
| tnx its helps me a lot i successfully run my simple calculator....
Computer innovation center of tagum incorporated student |
|
 |
| | thank you dimport..godblesssssss |
|
 |
| | if you are even were mildly capable programmer then you would be able to figure that out yourself, anywho, for the sake of stating the obvious: ElseIf sign = "%" Then
txtDisplay.Text
= first % second
if you cant figure out where that goes then I'd recommend jumping of the highest structure you can find as many times as possible, but you may as well do that anyway just for fun :) |
|
 |
| | Might have been a bit harsh/non-constructive, if you feel the need to ask something so basic its apparent that you don't really know what your doing, even just looking through the code its intuitive as to what the modulo(%)(or modulus if your American) part should be even with minimal knowledge of programming (its not even far from English), so next time you feel like asking a question you should put some effort in: look up what you don't know on google (i.e. VB for beginners) and then try to solve the problem yourself, that way you get less harsh comments and you'll actually better yourself! |
|
 |
| | is the equal sign button included in the command 2 array>? |
|
 |
| I would like to ask whether anyone knows visual basic6.0. If you do could you email me a calculator code with on vb6.0 . . PLEASE send me one .this is my @ add.<narshaxx09@yahoo.com>
|
|
 |
| hey...thanks u for giving me nice codes in making a calculator.......
keep the good work master....<!> |
|
 |
| I need proper code for creating calcultor in vb 6.0
u given code doesnot eixt |
|
 |
| | Hey, im making a calculator, and i have all these signs: / * - + , and they are working. But to get a higher mark i need to add extra buttons.. how do i do? and how do i make decimals ? |
|
 |
| This is a very well written article.Easy to follow.I am happy that I came across this.Thank you.
Visite Online-Flash-Game.com and play online Shockwave games |
|
 |
| | i want scintific calculator program |
|
 |
| Hey guy listen
If i Had a bucket and dumped it into this bucket it make a variable. THERE ARE TWO TYPES OF BUCKETS |
|
 |
| | Please keep comments on topic and constructive. If you have nothing constructive to add . . . leave. |
|
 |
| |
 |
| hello eveyone!
do someone know where can i find a calculator code that when u insert a value to the textbox and press on the operator (+,- etc) the number remain on the textbox and just after you begin to insert the second value the new calue remove the old one and display on the txtbox.
Please help me. thank's a lot =) |
|
 |
| thanks for help me on the calcular program i expect more on the vb.net
thank you |
|
 |
| | i need a vb.net code for calculating more than 2 digit . the above accepts only 1 digit numbers plz........ i need it for my ug bsc project......plz..... |
|
 |
| | i tried to use this in my class and it was to dang hard to understand it lol |
|
 |
| | the code is somewhat not right???? |
|
 |
| i would like to ask the code for calculator
|
|
 |
| | hi guys... i nid some help with this code.. as where to input the code forthe functions like +, -, %, x, / , and some other functions, if someone could help,, kindly mail me at my email add, i.Scadi@yahoo.com, pls i realy nid your help for my final project.. |
|
 |
| | uh. guys.. where can i found the public class form1? anyone can tell me me? |
|
 |
| | this is in vb6 language, not .net. that means that i cant make one :( |
|
 |
| | you can, just not exactly like this :P |
|
 |
| | how?did you get this code? |
|
 |
| Private Sub Command1_Click()
If List1.ListIndex = 0 Then
Div Intrest is Integer
Intrest = Text1.Text * 0.08
Text2.Text = Text1.Text + Income
End If
End Sub
whats wrong? |
|
 |
| | i need code for x^2 and x^3 any help is appreciated |
|
 |
| | isn't it just x^2 and x^3 in VB? |
|
 |
| | Do someone know where can i find a calculator code that when u insert a value to the textbox and press on the operator (+,- etc) the number remain on the textbox and just after you begin to insert the second value the new calue remove the old one and display on the txtbox. online games |
|
 |
| | does any1 knw the code to find out the average?? |
|
 |
|
How does one mathematically determine an average? How could you write a single function to accomplish this?
These are the questions you should be asking yourself. We're not here to do your school project for you. |
|
 |
| | this was not right . totally false codes for running calculator programming.it's a fake program. |
|
 |
| Sqrt,M,MR,MC,M+,+/-,C,CE
what is the code of this feature of calculator? |
|
 |
| | It would help if you did a bit of Labeling and explaining =/. Good try on the attempt, but my personal opinion on the definition of a tutorial is to learn how to do something, then be able to like dissect it to use parts of what the reader leraned in other projects. |
|
 |
| Hey... i have a question...
Just trying to learn how to use the program, and i was wondering..
Private Sub cmdDot_Click()
If InStr(txtDisplay.Text, ".") = 0 Then
txtDisplay.Text
= txtDisplay.Text & "."
End If
End Sub
If there is a "." in the string, then write the numbers and the "." My calc works and i can put in the ".", but it works with the number as if there is no "."
Am i blind and missing something obvious??
Thx |
|
 |
| Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles one.Click
one.Text = "1"
txtAnswer.Text += "1"
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAnswer.TextChanged
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles six.Click
six.Text = "6"
txtAnswer.Text += "6"
End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles c.Click
Dim a
txtAnswer.Text = " "
a = TxtAnswer.text
c.Text = a
End Sub
Private Sub two_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles two.Click
two.Text = "2"
txtAnswer.Text += "2"
End Sub
Private Sub three_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles three.Click
three.Text = "3"
txtAnswer.Text += "3"
End Sub
Private Sub four_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles four.Click
four.Text = "4"
txtAnswer.Text += "4"
End Sub
Private Sub five_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles five.Click
five.Text = "5"
txtAnswer.Text += "5"
End Sub
Private Sub seven_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles seven.Click
seven.Text = "7"
txtAnswer.Text += "7"
End Sub
Private Sub eight_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles eight.Click
eight.Text = "8"
txtAnswer.Text += "8"
End Sub
Private Sub nine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nine.Click
nine.Text = "9"
txtAnswer.Text += "9"
End Sub
Private Sub zero_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles zero.Click
zero.Text = "0"
txtAnswer.Text += "0"
End Sub
Private Sub a_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles a.Click
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
|
|
 |
| Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles one.Click
one.Text = "1"
txtAnswer.Text += "1"
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAnswer.TextChanged
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles six.Click
six.Text = "6"
txtAnswer.Text += "6"
End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles c.Click
Dim a
txtAnswer.Text = " "
a = TxtAnswer.text
c.Text = a
End Sub
Private Sub two_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles two.Click
two.Text = "2"
txtAnswer.Text += "2"
End Sub
Private Sub three_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles three.Click
three.Text = "3"
txtAnswer.Text += "3"
End Sub
Private Sub four_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles four.Click
four.Text = "4"
txtAnswer.Text += "4"
End Sub
Private Sub five_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles five.Click
five.Text = "5"
txtAnswer.Text += "5"
End Sub
Private Sub seven_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles seven.Click
seven.Text = "7"
txtAnswer.Text += "7"
End Sub
Private Sub eight_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles eight.Click
eight.Text = "8"
txtAnswer.Text += "8"
End Sub
Private Sub nine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nine.Click
nine.Text = "9"
txtAnswer.Text += "9"
End Sub
Private Sub zero_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles zero.Click
zero.Text = "0"
txtAnswer.Text += "0"
End Sub
Private Sub a_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles a.Click
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
|
|
 |
| | the numbers are not coming in display box |
|
 |
| mister.. dim
thx for the help!! ^^
|
|
 |
| | can you please help me out for the codes of calculator, i dont know the code once you got the answer for the two numbers.for example, i added 4 + 5 = 9, then the answer '9' will be divided or added etc. by another digit at he same time not clearing the screen.. a big thanks for the answer,, |
|
 |
| | i need simple calculator program with the forms |
|
 |
| Option Explicit
Dim x As Double
Dim y As Double
Dim z As Double
Dim i As Integer
Dim e As Integer
Dim m As Integer
Dim a As Integer
Private Sub command1_click()
m = 1
Call inval(m)
End Sub
Private Sub Command2_Click()
m = 2
Call inval(m)
End Sub
Private Sub Command3_Click()
m = 3
Call inval(m)
End Sub
Private Sub Command4_Click()
m = 4
Call inval(m)
End Sub
Private Sub Command5_Click()
m = 5
Call inval(m)
End Sub
Private Sub Command6_Click()
m = 6
Call inval(m)
End Sub
Private Sub Command7_Click()
m = 7
Call inval(m)
End Sub
Private Sub Command8_Click()
m = 8
Call inval(m)
End Sub
Private Sub Command9_Click()
m = 9
Call inval(m)
End Sub
Private Sub Command10_Click()
m = 0
Call inval(m)
End Sub
Private Sub Command11_Click()
If e = 1 Then
Text1.Text = "."
e = e + 1
Else
Text1.Text = Text1.Text & "."
End If
End Sub
Public Function inval(ByRef x As Integer)
If e = 1 Then
Text1.Text = x
e = e + 1
Else
Text1.Text = Text1.Text & x
End If
End Function
Private Sub Command12_Click()
x = x + Val(Text1.Text)
Text1.Text = x
e = 1
i = 1
End Sub
Private Sub Command13_Click()
x = Val(Text1.Text)
e = 1
i = 2
End Sub
Private Sub Command14_Click()
x = Val(Text1.Text)
e = 1
i = 3
End Sub
Private Sub Command15_Click()
x = Val(Text1.Text)
e = 1
i = 4
End Sub
Private Sub Command16_Click()
y = Val(Text1.Text)
e = 1
Select Case i
Case 1
z = x + y
Text1.Text = z
Case 2
z = x - y
Text1.Text = z
Case 3
z = x * y
Text1.Text = z
Case 4
z = x / y
Text1.Text = z
End Select
End Sub
Private Sub Command17_Click()
Text1.Text = Sqr(Text1.Text)
e = 1
End Sub
Private Sub Command18_Click()
Text1.Text = 1 / Val(Text1.Text)
e = 1
End Sub
Private Sub Command19_Click()
x = 0
Text1.Text = "0"
e = 1
End Sub
Private Sub Command20_Click()
Text1.Text = "0"
e = 1
End Sub
Private Sub Command21_Click()
x = Val(Text1.Text)
x = x \ 10
Text1.Text = x
e = 1
End Sub
Private Sub Command22_Click()
Text1.Text = -1 * Val(Text1.Text)
e = 1
End Sub
Private Sub Command23_Click()
x = Val(Text1.Text)
e = 1
Label1.Caption = "M"
End Sub
Private Sub Command24_Click()
Text1.Text = x
Label1.Caption = "M"
e = 1
End Sub
Private Sub Command25_Click()
x = 0
Label1.Caption = ""
e = 1
End Sub
Private Sub Command26_Click()
y = Val(Text1.Text)
x = x + y
Label1.Caption = "M"
e = 1
End Sub
Private Sub Command27_Click()
y = Val(Text1.Text)
z = x * (y / 100)
Text1.Text = z
e = 1
End Sub
Private Sub Form_Load()
Text1.Text = "0"
Label1.Caption = ""
e = 1
End Sub
Private Sub Text1_keypress(KeyAscii As Integer)
If KeyAscii > 32 And KeyAscii < 42 Then
KeyAscii = 0
ElseIf KeyAscii > 57 Then
MsgBox "nonnumeric data entered", vbOKOnly, "invalid data"
KeyAscii = 0
Else
Text1.Text = Text1.Text
e = 2
End If
End Sub
|
|
 |
| can u please give me all the codes regarding this calculator?
thanks!!!!! |
|
 |
| | _sir..plz im begging to ask for a complete code of calculator through the visual basic 6.0 |
|
 |
| |
 |
| its hard to analyz
by the way wat..wat is the code of +?? |
|
 |
| Public Class Form1
Dim s = 0, a As Integer
Dim op As String
Dim b As String
Dim c As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnone.Click
a = 1
txtDisplay.Text = "1"
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btntwo.Click
a = 2
txtDisplay.Text = "2"
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnthree.Click
a = 3
txtDisplay.Text = "3"
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnfour.Click
a = 4
txtDisplay.Text = "4"
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnfive.Click
a = 5
txtDisplay.Text = "5"
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsix.Click
a = 6
txtDisplay.Text = "6"
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnseven.Click
a = 7
txtDisplay.Text = "7"
End Sub
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btneight.Click
a = 8
txtDisplay.Text = "8"
End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnine.Click
a = 9
txtDisplay.Text = "9"
End Sub
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnzero.Click
a = 0
txtDisplay.Text = "0"
End Sub
Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdplus.Click
s = Integer.Parse(txtDisplay.Text)
op = "+"
txtDisplay.Text = ""
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class |
|
 |
| ^
^
^
wat is the problem in this code above??
can u plz help me!!
|
|
 |
| | i want to upload my code for calculator in vb how can i do that |
|
 |
| Private Sub cmdadd_Click()
Dim a As Variant
Dim b As Variant
Dim c As Variant
a = Val(txt1.Text)
b = Val(txt2.Text)
c = a + b
txtresult.Text = c
End Sub
Private Sub cmdsub_Click()
Dim a As Variant
Dim b As Variant
Dim c As Variant
a = Val(txt1.Text)
b = Val(txt2.Text)
c = a - b
txtresult.Text = c
End Sub
Private Sub cmdclear_Click()
txt1.Text = "0"
txt2.Text = "0"
txtresult.Text = "0"
End Sub
Private Sub smdmult_Click()
Dim a As Variant
Dim b As Variant
Dim c As Variant
a = Val(txt1.Text)
b = Val(txt2.Text)
c = a * b
txtresult.Text = c
End Sub
Private Sub cmddiv_Click()
Dim a As Variant
Dim b As Variant
Dim c As Variant
a = Val(txt1.Text)
b = Val(txt2.Text)
c = a / b
txtresult.Text = c
End Sub |
|
 |
| | i want to create a code for arithmetic calculator in vb how can i do that... |
|
 |
| where should i place this code?
Private Sub Command1_Click(Index As Integer)
If txtDisplay.Text = "" Then
txtDisplay.Text
= Command1(Index).Caption
Else
txtDisplay.Text
= txtDisplay.Text & Command1(Index).Caption
End If
End Sub |
|
 |
| I find it very difficult to create a project..using visual Basic 2008..without even knowing first the version 6.0.....I'm just a beginner..
|
|
 |
| Right, no offence everyone but there is a really good search engine out there.
Google!
Search google for vb.net calculator, and to make it easier for you I have even got a link!
http://www.a1vbcode.com/app-4551.asp
Refrenct this Project when you are making your calculator and you should be fine, its all done for you, all you need to do is copy & paste!
Feel free to
Email me at tyopdfdf@live.co.uk
Cms me on Cyberarmy (Todd434)
http://www.cyberarmy.net
Message me on Osix (Here)
|
|
 |
| | what is the code for AC???ANYONE CAN HELP ME! |
|
 |
| | can you give me the whole code for simple calculator??----gaspar |
|
 |
| | can i know how to do the calculator matrix?? |
|
 |
| Public Class Form1
Dim sum As Double = 0
Dim operand As String = ""
Dim value1 As Double = 0
Dim value2 As Double = 0
Private Sub btnOne_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOne.Click
txtBox1.Text += "1"
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBox1.TextChanged
End Sub
Private Sub btnTwo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTwo.Click
txtBox1.Text += "2"
End Sub
Private Sub btnThree_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThree.Click
txtBox1.Text += "3"
End Sub
Private Sub btnFour_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFour.Click
txtBox1.Text += "4"
End Sub
Private Sub btnFive_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFive.Click
txtBox1.Text += "5"
End Sub
Private Sub btnSix_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSix.Click
txtBox1.Text += "6"
End Sub
Private Sub btnSeven_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSeven.Click
txtBox1.Text += "7"
End Sub
Private Sub btnEight_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEight.Click
txtBox1.Text += "8"
End Sub
Private Sub btnNine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNine.Click
txtBox1.Text += "9"
End Sub
Private Sub btnZero_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnZero.Click
txtBox1.Text += "0"
End Sub
Private Sub btnDot_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDot.Click
Dim btnDot As Boolean = False
If txtBox1.Text.IndexOf(".") >= 0 Then btnDot = True
If btnDot = False Then txtBox1.Text += "."
End Sub
Private Sub btnEquals_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEquals.Click
value2 = Val(txtBox1.Text)
Select Case operand
Case Is = "+"
txtBox1.Text = (value1 + value2).ToString
Case Is = "-"
txtBox1.Text = (value1 - value2).ToString
Case Is = "X"
txtBox1.Text = (value1 * value2).ToString
Case Is = "/"
If value2 <> 0 Then
txtBox1.Text = (value1 / value2).ToString
End If
End Select
End Sub
Private Sub btnPlus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlus.Click
operand = "+"
If checkInput() = True Then value1 = CDbl(txtBox1.Text)
txtBox1.Clear()
End Sub
Private Sub btnMinus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMinus.Click
operand = "-"
If checkInput() = True Then value1 = CDbl(txtBox1.Text)
txtBox1.Clear()
End Sub
Private Sub btnTimes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTimes.Click
operand = "X"
If checkInput() = True Then value1 = CDbl(txtBox1.Text)
txtBox1.Clear()
End Sub
Private Sub btnDivide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDivide.Click
operand = "/"
If checkInput() = True Then value1 = CDbl(txtBox1.Text)
txtBox1.Clear()
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
txtBox1.Clear()
sum = 0
End Sub
Private Function checkInput() As Boolean
If IsNumeric(txtBox1.Text) = True And txtBox1.Text <> "" And txtBox1.Text <> Nothing Then
Return True
Else
Return False
End If
End Function |
|
 |
| | im searching for searching coding in vb. example, im searching harry,, and my result will display all harry names in my database. is there any coding for it, doesn't it impossible? |
|
 |
| | please give e a calculator program in visual basic |
|
 |
| | Hi, can you help to make a simple calculator in visual basic. the code just like a simple calculator in computer..tnx send to this email Alan_JaNDy2009@yahoo.com |
|
 |
| thanks for help me on the calcular program i expect more on the vb.net
thank you |
|
 |
| thanks for the creator codes in java thank3X..
>>LEE MIN HO<< |
|
 |
| can you plz. help me making a code for calculatiions in vb with 1 textbox and has diff, commands....?????////>>><<><>>
thank you in advance,,,,
<<<<<kill_hitman>>>>>> |
|
 |
| |
 |
| Guys, I am a rookie in VB 2008 and am designing a calculator with those detils:
textbox1
textbox2
textboxDisplay3
btnPlus
btnMinus
btnTimes
btnDivide
=
lblDisplayOperator ' to display the sign e.g +,-,x and / when for example btnPlus is clicked it will display textbox1 + textbox2 = texboxDisplay3
on top of that I have to check the value of numbers that it is more than zero (0) and less than 100....
any help would be appreciated
this is my code which is taking me ages.
what I think im missing is the code that goes in the button_click event i.e. button_plus, minus, divide and times
--------------------------------------------------
Public Class New_Calculator_Form
' Author: Avni Coga
' Date: 20 October 2009
'Description: The user will input two number in two separeate text boxes and click on the +,-,x,/ operators where it
'will display the opeartor symbol and the answer in a separate text box, also it will check that the number is inbetween 1 - 100.
' declaring the global variables
Dim num1 As Integer
Dim num2 As Integer
Dim TotalSum As Integer
Private Function DivideError(ByVal Error1 As Single, ByVal Error2 As Single)
Dim ErrValue As Boolean ' declaring the variable as boolean True/False
'checks the value for True or false
If Error1 > 1 Then
ErrValue = False
ElseIf Error2 < 99 Then
Error2 = False
Else
ErrValue = True
End If
Return ErrValue
End Function
Private Function AddNumbers(ByVal num1 As Integer, ByVal num2 As Integer) As Integer
Dim aOperator, Plus, Minus, Multiply, Divide As String
Dim LocalTotal As Integer
Plus = aOperator
Minus = aOperator
Multiply = aOperator
Divide = aOperator
Select Case aOperator
Case "+"
aOperator = "+"
LocalTotal = num1 + num2
Case "-"
aOperator = "-"
LocalTotal = num1 - num2
Case "/"
aOperator = "/"
LocalTotal = num1 / num2
Case "*"
aOperator = "*"
LocalTotal = num1 * num2
End Select
TotalSum = LocalTotal ' local sum gets assigned to Totalsum
Return TotalSum 'return the totalsum
End Function
Private Sub btnPlus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlus.Click
Dim x As Integer ' declaring x as integer
num1 = txtbox1.Text ' assig the values of num1 & num2 to texbox1 and 2
num2 = txtbox2.Text
x = AddNumbers(num1, num2) 'assigning the value of "num1, num1 " to x
' displaying the value of "x" to text box display
txtboxDisplayTotal.Text = TotalSum
End Sub
Private Sub btnMinus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMinus.Click
End Sub
Private Sub btnTimes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTimes.Click
End Sub
Private Sub btnDivide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDivide.Click
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close() 'Exit the program
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
txtbox1.Clear() 'Clear all the text boxes
txtboxDisplayTotal.Clear()
txtbox2.Clear()
End Sub
End Class
respect Nino.
avni.coga@gmail |
|
 |
| |
 |
| |
 |
| | lollllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
|
 |
 |
 |
 |
Anonymously add a comment: (or register