Question: When I'm at plus = true , I get error that plus is already in use. I searched, and the only other plus is the bool plus = false; . Any suggestions?
Guys I hope you know that anything you do in VisualANYTHING is NOT programming. If you want to do programming you have to learn the idea of everything you use (and by everything I mean EVERYTHING). This is as hard as drawing a picture with paint. This is not what programmers learn in university. Just for you to know...
Hi, great tutorial. I have found a bug in my calc, unsure whether you will have the same. Been through the videos twice now to check the code, same as yours as far as I can see.
If I do a calculation then immediately do another 1 without clearing the field I get negative numbers, prior to the checkifequal I think it was working ok. Any chance of you just running through my code?
Excuse me, but I tried to type like you said on the buttons of 1,2,3,4,5,6,7,8, & 9 by " textBox1.Text " but the problem is it doesn't work with me at all, which the error message says: " The name 'textBox1' does not exist in the current context. So, is there anything else I put in there instead of that?
i have a project for tomorrow, to submit a simple calculator, ive done the coding but i dont know how to make it loop like after ive done it will ask if i like to continue . . . mine just exit! plus i need flow chart for my coding . .. . .. . help :(
just a little tip , when you need to add something to a (i'm not sure how it called , like int or textBox1.text in this example ) instead of writing it twice (textbox = textbox +)
just write += it is the same and it sortens your work [ textbox.text += ("1") ; ]
I'm having problems with my equals button. "It says 'Decimal ' is a type and cannot be use as an expression." I tried a few thing (I have no idea what I did) and I got it to come up as true or false but I changed it back. I'm confused about what goes after the 'Decimal' and if I have to 'Dim' "dec" or something. Any ideas on how yo fix it?
can someone help me? everytime I enter the code for "1" a debugger pops up and it crashes my program, making me have to restart. How do i fix it?? its bugging the shit out of me!
Can you help me? Im having a lot of trouble with the decimal part, it just wont work. I copyed down exactly what you did and still nothing. This is the line of code i start with after duoble clicking the decimal button private void button2_Click(object sender, EventArgs e) { } }
} it doesnt say private void buttonDecimal_Click like yours does, could that be the problem?
Nice work! Came here, searching on how to make a simple forms calculator using VS... I have two text boxes that I use as my input boxes, and a button that adds them, displaying the result in a 'label' field. as you explained, just adding numbers takes some work!
private void button1_Click ( object sender, EventArgs e ) { decimal ans = Convert.ToDecimal ( textBox1.Text ) + Convert.ToDecimal ( textBox2.Text ); answer.Text = Convert.ToString ( ans ); }
hi, great vid ! thank u ! when i press the decimal button ," System.Windows.Forms.TextBox, Text: ." this text is coming do you kw y ? plz help new to c sharp. thanks in advance.
I need HELP! Why is it when i create a plain win32 project i dont get the "form design" tab? All i can edit is the file menus and such, i am unable to add buttons. And if its not possible, whats the difference between form app and win32?
at 3:20 i get an error for the TextBox1.text = textBox1.Text + ".";
the error says: "The name 'TextBox1' does not exist in the current context." the first part, before the equal sign is where this occurs.... could you help me? =]
How would you set the textbox1 to display "0" such as in a Windows calculator? Then once a number button is clicked, the value of "0" would be replaced by whatever a user pressed?
Hello, this tutorial is really helpful, but I am using the vb2008 express edition and i can't do the + button, the bool feature doesnt exists. Any help please?
I am trying to follow your tutorial, and im a noob even at basic coding. But i noticed that your formatting is very different. I am working around it but i am having to type different things to get the same result. Im stuck on bool, it says declaration expected under the error code. Any suggestions :s ? Sorry if that sounds confusing.
@daboos2008 I did not fully test the code and no longer have it so I am not sure what it does. It probably doesn't work so you should find a way to fix it :)
This has been flagged as spam show
if any want learn asp.net with C sharp Contact me +92-315-7609928
Zia Ullah Faisalabad
ziaullahziag@yahoo.com
ziaullahziag1980 2 months ago
when i'm done this in a couple minutes my co-workers will be impressed
lonialbo33prn 4 months ago
thank you for this video. this was very helpful :))
gfilipecz 5 months ago
Hey, the error message I get is System.Web.UI.WebControls.TextBox' does not contain a definition for 'Tag
I have followed your code to the letter. Any suggestions?
318north 5 months ago
Question: When I'm at plus = true , I get error that plus is already in use. I searched, and the only other plus is the bool plus = false; . Any suggestions?
ronaldl911 5 months ago
Guys I hope you know that anything you do in VisualANYTHING is NOT programming. If you want to do programming you have to learn the idea of everything you use (and by everything I mean EVERYTHING). This is as hard as drawing a picture with paint. This is not what programmers learn in university. Just for you to know...
emeres11 5 months ago
Comment removed
adamgb35 6 months ago
Comment removed
tommyAryan 6 months ago
instead of: textBox1.Text = textBox1.Text + "1";
You can use 1 event click to all the numbers (1-9)
try the code below:
textBox1.Text += (sender as Button).Text;
Basskingdom 6 months ago
any tips on remembering all the code???
FTD0Productions 6 months ago
how could you make it so that numbers could be entered from the keyboard rather than by having to click them on the form?
614DaBest 6 months ago
You made it way to complicated, you don't need all of the ' { ' and ' } 's
MylesXO 6 months ago
What about a delete button
SecondCocacola 7 months ago
Is it possible to set more than one button as AcceptButton?
puremaths729 7 months ago
/watch?v=sOuak_F9DbY
/watch?v=sOuak_F9DbY
/watch?v=sOuak_F9DbY
/watch?v=sOuak_F9DbY
/watch?v=sOuak_F9DbY
/watch?v=sOuak_F9DbY
/watch?v=sOuak_F9DbY
/watch?v=sOuak_F9DbY
/watch?v=sOuak_F9DbY
GaionGold 7 months ago
Hi, great tutorial. I have found a bug in my calc, unsure whether you will have the same. Been through the videos twice now to check the code, same as yours as far as I can see.
If I do a calculation then immediately do another 1 without clearing the field I get negative numbers, prior to the checkifequal I think it was working ok. Any chance of you just running through my code?
Thanks
dashby1969 7 months ago
Excuse me, but I tried to type like you said on the buttons of 1,2,3,4,5,6,7,8, & 9 by " textBox1.Text " but the problem is it doesn't work with me at all, which the error message says: " The name 'textBox1' does not exist in the current context. So, is there anything else I put in there instead of that?
Bedaywee 8 months ago
@Bedaywee Check the proporties of the text box you have on the form1. see if its name is textBox1 or try to rename it.
HockeyandlaxKING 6 months ago
easy way for all number buttons
buttonOnClick(object sender, EventArgs e)
{
text1.Text += this.Text;
}
add this event for all buttons
willissteve0 8 months ago
instead of doing the if statement for checking for a "." to return if found, do this:
if (! textbox.text.Contains("."))
{ textbox.text += ".";
}
this way it'll add the . only if there isn't one in there, otherwise it does nothing
finnvoid 9 months ago
i have a project for tomorrow, to submit a simple calculator, ive done the coding but i dont know how to make it loop like after ive done it will ask if i like to continue . . . mine just exit! plus i need flow chart for my coding . .. . .. . help :(
WeezyIsMusic 9 months ago
just a little tip , when you need to add something to a (i'm not sure how it called , like int or textBox1.text in this example ) instead of writing it twice (textbox = textbox +)
just write += it is the same and it sortens your work [ textbox.text += ("1") ; ]
TheMrTrapatony 10 months ago
0:01
drakonimetal 11 months ago
finally a NON console tutorial
player0pokemon0vince 11 months ago
I'm sick of commercials
InfoSysSenior 11 months ago
you could easily say tbxText.AppendText(string)
adiosundfeuerfrei 11 months ago
Can you please tell me the code for backspace button?
raheelbutt92 1 year ago
Thanks a lot man! it helps me greatly.
raheelbutt92 1 year ago
dude - you sound like you'r sleeping xD
3DSClep15 1 year ago
HOW TO USE THE CONTAINS AND REMOVE ADD FUNCTIONS IN VISUAL C++
nawazsucks 1 year ago
dude sounds sleepy :)
cunaaye00 1 year ago
i hate BOOL DX
MRA0000000000Z 1 year ago
i love your vids!!!! keep on going:)
lol9392 1 year ago
hello and ty for upload, but i just wanna know if this works in 2010 too :) since thats what we are working with in school :)
martinfmadsen 1 year ago
why not textbox1.text += "1";?
JonaasK 1 year ago
Comment removed
JonaasK 1 year ago
So textbox1 is a char array and its automatically adding each character number to the next element?
dying2l 1 year ago
sings: peak kia car diarrhea!
dying2l 1 year ago
I'm having problems with my equals button. "It says 'Decimal ' is a type and cannot be use as an expression." I tried a few thing (I have no idea what I did) and I got it to come up as true or false but I changed it back. I'm confused about what goes after the 'Decimal' and if I have to 'Dim' "dec" or something. Any ideas on how yo fix it?
littlemcnuggster 1 year ago
can someone help me? everytime I enter the code for "1" a debugger pops up and it crashes my program, making me have to restart. How do i fix it?? its bugging the shit out of me!
AndrewHoughtonTV 1 year ago
Can you help me? Im having a lot of trouble with the decimal part, it just wont work. I copyed down exactly what you did and still nothing. This is the line of code i start with after duoble clicking the decimal button private void button2_Click(object sender, EventArgs e) { } }
} it doesnt say private void buttonDecimal_Click like yours does, could that be the problem?
TryNotTooBLiNK 1 year ago
@TryNotTooBLiNK okay it isnt working T_T
TryNotTooBLiNK 1 year ago
@TryNotTooBLiNK Nevermind, i started over and did all of your steps exactly how you do em andim done with my calculator! :D THANKS
TryNotTooBLiNK 1 year ago
Nice work! Came here, searching on how to make a simple forms calculator using VS... I have two text boxes that I use as my input boxes, and a button that adds them, displaying the result in a 'label' field. as you explained, just adding numbers takes some work!
private void button1_Click ( object sender, EventArgs e ) { decimal ans = Convert.ToDecimal ( textBox1.Text ) + Convert.ToDecimal ( textBox2.Text ); answer.Text = Convert.ToString ( ans ); }
JetCityTrading 1 year ago
hi, great vid ! thank u ! when i press the decimal button ," System.Windows.Forms.TextBox, Text: ." this text is coming do you kw y ? plz help new to c sharp. thanks in advance.
hafizfalul123 1 year ago
I need HELP! Why is it when i create a plain win32 project i dont get the "form design" tab? All i can edit is the file menus and such, i am unable to add buttons. And if its not possible, whats the difference between form app and win32?
Tyler11440 1 year ago
could you please give me the source code, because I want to learn how you do it.
send it to my email address phuastanley2006@yahoo.co.jp
Thank you in advance
stanleypleng 1 year ago
ok i am making a program how do i use a button to open another window(project)?
xXbullet002Xx 1 year ago
@xXbullet002Xx just double click on that button
barbie4351 1 year ago
The decimals don't work, when you enter: 0.01 + 0.6 it says 7, instead of 0.61 Help pls?
gunnerll 1 year ago
@xixw you read my mind :P
AlexMikael 1 year ago
good one dude...!
thisisgaurang 1 year ago
You would have saved some time if you had done this.
void Digit_Clicked(object sender, EventArgs e)
{ Button tempButton = (Button)sender; textBox1.Text += tempButton.Text;
}
and then just apply this to every digit button.
budabudimir3 1 year ago
Nice tutorial. Really helpful.
Ruchir5 1 year ago
at 3:20 i get an error for the TextBox1.text = textBox1.Text + ".";
the error says: "The name 'TextBox1' does not exist in the current context." the first part, before the equal sign is where this occurs.... could you help me? =]
Sharpielotr123 1 year ago
when ive made my calculator, ive written code for the "1" button, but when i debug my calculator is blank
Sharpielotr123 1 year ago
Is this scripting language similar to LUA?
I know pretty much lua and it would be great if C sharp was not to different :/
Kirbydude777 1 year ago
How would you set the textbox1 to display "0" such as in a Windows calculator? Then once a number button is clicked, the value of "0" would be replaced by whatever a user pressed?
atlanta5hawks 1 year ago
check it dude.
for example.
0.1 + 0.9
doesn't work :)
vanyaxxx 1 year ago 4
to make it a lot nicer you can change textBox1's TextAlign to Right and change the Form's border style to fixed 3D
N1njafication 1 year ago
Comment removed
qubec3 1 year ago
hello QuackWare u've written a really tutorial but i dont ther's some problem occured with streming of video
ther's always an error occured
please send me its code plz.
qubec3 1 year ago
Hello, this tutorial is really helpful, but I am using the vb2008 express edition and i can't do the + button, the bool feature doesnt exists. Any help please?
ivoivo001 1 year ago
@ivoivo001
Never really used vb.net but I do know for a fact that there is a bool data type in visual basic.
Something like this:
Dim isCool As Boolean = True
' If statement
If isCool Then MsgBox("Quackware is cool")
End If
Would be the simplest of examples.
QuackWare 1 year ago
@QuackWare
Fixed this as well
in vb2008 express you have to write the following code above ur scrip":
"dim dec as decimal"
ivoivo001 1 year ago
@ivoivo001
navjot1331 1 year ago
hey what if i wanna add a sin ,cos, tan etc. to my calculator
and also want a textbox to be multiline upper line shows the expression and lower line shows current value that is inputtted.....
navjot1331 1 year ago
@navjot1331
For sin, cos, tan there are built in C# functions, Math.Sin() Math.Cos() Math.Tan()
For the multilines you would have to mess around with the textbox properties, I don't know how to do this off the top of my head.
QuackWare 1 year ago
I am trying to follow your tutorial, and im a noob even at basic coding. But i noticed that your formatting is very different. I am working around it but i am having to type different things to get the same result. Im stuck on bool, it says declaration expected under the error code. Any suggestions :s ? Sorry if that sounds confusing.
Joeyz1994 1 year ago
@Joeyz1994 If you send me your source code or an image of your source code with the error I can try and debug it and see what is wrong.
QuackWare 1 year ago
@QuackWare How do you do a clear button? Your video stopped loading and I need to know lol.
FreakiestGolf 1 year ago
@Joeyz1994 are you sure you are using c# and not visual basic, c++, or another language?
HockeyandlaxKING 6 months ago
wow so visual studio is for making server programs programs and stuff like that?
dranoel1963 1 year ago
Great Tutorial!
Thank you very much :)
ahmedsamy 1 year ago
Dear Quack
Just seen the first part of your video and I got a doubt.
If I were to add -1+-1 and -1 - -1
Will it work.
daboos2008 1 year ago
@daboos2008 I did not fully test the code and no longer have it so I am not sure what it does. It probably doesn't work so you should find a way to fix it :)
QuackWare 1 year ago
How in the hell... The stuff you were explaining wasn't working, so I changed some of the code to GML and it actually worked. FUCK YEAH GAME MAKER!
HeyChummers 1 year ago
im used to visual bsic and in visual basic fo the pos negative i just pu
textbox1.text = val(textbox1.text) * (-1)
i really enjoyed the val function because it allowed me to make cacluations inside the code is there a funtion like this in c#
XDalutZX 1 year ago
thanx a lot QuackWare..Much needed one for me..cheers..:D
RavinduM 1 year ago
I would write:
textBox1.SelectedText = "1";
not:
textBox1.Text = textBox1.Text + "1";
darkadinin 1 year ago 3
im suscribed
Grandboy3000 1 year ago 2
hi guys i have a question i also want a Backspace button.
som1 can tell me the code for backspace?
thank you for help :)
GShock2 2 years ago 2
thanks alot
Gmicrosh 2 years ago 2
Why am i getting " plus is not declared" ???? :( please help me out:)
sondrern95 2 years ago
Really excellent stuff, just a few comments and one questions. Comments first.
- building the form can be complicated, maybe show how to do it.
- there's no '0'. Programming it is harder then other numbers.
- Your voice should be louder and you sound like you're medicated.
Question
- Why don't the keys in the keypad show the numbers the same way the windows calc does?
- In the command prompt version of c# you can do +=, (like a = a + b), but you can't here. What up with that?
thanks!!!!!!!
bluesdave991 2 years ago
You can use += in visual c#. As for the keys, you need to use the key events to get the pressed keypad number or any other key for that matter.
trieye 2 years ago
thank you dude
thats perfect
please do it more ;)
jeffrykhan 2 years ago
i have visual studio 2010 and dont know where to put bool plues = false. help pelase
WeeklyPranksByAkz 2 years ago
The program crashes when you divide by 0. How can that be fixed?
sbuckley010 2 years ago
catch the exception using "try-catch", for example:
equals_button_click()
{ try { // math operation code.....}
catch (Exception ex) { textBox1.text = ex.Message; }
}
this way it'll just show the error message on the text box without the program crashing.
trieye 2 years ago
This has been flagged as spam show
and for the equal button you type in
if (divide)
( if(textBox.Text == "0") ( Messagebox.show("can not divide by 0"); ) else
(
decimal dec = Convert.ToDecimal (textBox1.Tag) / Convert.ToDecimal (textBox1.Text)
textBox1.Text = dec.ToString();
)
Gmicrosh 2 years ago
you could type in the divide button
if (Textbox1.Text == "0")
(
Messagebox.show("can not divide by 0");
)
else
divide = true;
textBox1.Tag = textBox1.Text;
textBox.Text = "";
Gmicrosh 2 years ago
why my program does not work? I've followed all your instructions.. btw, mine is VS 2005. does it affects the program?
wikoo2807 2 years ago
The code might not necessarily be the same, especially since I premade most of the GUI elements so they might be named differently.
QuackWare 2 years ago
you sould use comments in your code. There'isnt any comments. That is absolutely bad programming.
neutrino216 2 years ago
@neutrino216 who are you?
ivanlp4ever 1 year ago
Good presentation!
tolikrog 2 years ago
I love u! AND U MADE HD!!!!!! Your my god! Please keep uploading vids! I really need ppl like you to help us newbies!!
GodMIKE009 2 years ago 2
You should probably use cntrl+v and cntrl+c more often :P
TheReasonWhyGuy 2 years ago
Thanks a lot!
I always wanted a calculator tutorial in C#.
puscasm 2 years ago
soo helpful Thanks!!!
89Salma89 2 years ago 2
gr8 job :)
just 1 comment
if( ! textbox.text.contents(".")) textbox.text=textbox.text + ".";
without else :)
less code, better code
cya
azog01 2 years ago 4
This tutorial is useless. It begins with the interface already done...
IrritatingMaze 2 years ago
@IrritatingMaze lolz, so you cant place some buttons on a form???
ivanlp4ever 1 year ago
Does anyone know why i dont have the .Tag function used in the Plus button?
I am using visual web developer 2008
jamesharrison1512 2 years ago
with which program u film this????
stinoNL 2 years ago
Nice vid.
DKaapNL 2 years ago
great vid dude !!!! please upload more videos for beginners thnks
loasim007 2 years ago
thanks man...... I was doing some thing with msdn, but they delete all their videos ..... so I must see it on ytb. .... thanks again....
11igor33 2 years ago
Thanks a lot that helped me! I know some c sharp but that cleared some things up, thanks again
great quality video!
Computer10171 2 years ago
It's the intelisense from Visual Studio 2008.
QuackWare 2 years ago
how do you get text thing to come up (i mean when you start typing)
andrewpocock1 2 years ago