My 10 year old son found this really helpful for a school project. Thank you, very clear explanation.
@TheOrLyricsAndMore10 жыл бұрын
Thanks !! I built it myself. You explain excellent and my English is not so good. But I understood everything you said. Everything works! Thank you again!
@sareeraafridi44515 жыл бұрын
What about point ?
@DivineGaming008 жыл бұрын
This is the first thing I've been able to successfully make in Visual Studio (2015), thank you!
@adityadasgupta57795 жыл бұрын
This video turned out to be a complete lifesaver for me. Thanks, Chris, for such an informative and to-the-point video. Subbed!
@klarapopilkova57913 жыл бұрын
This was so helpful. You commenting was also very useful, I dont see a lot of coders do that and I definitely appreciate that. With your system I was also able to add square and square root function or personalize the equation part. When you made a mistake you corrected it and said why it happened and why it should be this way so that is a plus for me too. So just thank you :D Edit: Also I used VS 2017 and it still worked perfectly.
@mileskenyon7 жыл бұрын
I forgot to thank you but you helped me pass an assignment last year. I was doomed without this. Thank you!
@nikoladjukovic801010 жыл бұрын
He forgot to debug calculator by preventing divide by zero. But in all other cases he did job perfectly!!!!! Well done.
@icedjadex4 жыл бұрын
This was a great tool! thanks so much. Saved me so much time not having to type out the code for each number! Awesome work!
@billdouglass895810 жыл бұрын
Thanks for sharing this... Nice introduction to Windows forms and C#... Finally a tutorial that doesn't create useless Console apps...
@danilovictor17 жыл бұрын
Que simplicidade no projeto, o código ficou fácil de entender, fácil de ler, e o importante, o código não ficou extenso ou enxado. Aprendi boas práticas nesse vídeo. Quando comparei o meu código com o seu, senti até vergonha... hahahaha.. Parabéns pelo tutorial. Ganhou mais um inscrito para o canal. Atenciosamente, Danillo Victtor - Brazil
@godfathermikal8 жыл бұрын
Sweet! I'm making the transition from Web Applications to Windows Forms and this is actually quite helpful! Thanks!
@chrismerritt729111 жыл бұрын
A continuation of this video is now available @ (Part 2) Visual Studio WinForm Windows Calculator Tutorial Example (C#). It addresses some additional functionality like allowing for running arithmetic operations without having to click equals every time (as pointed out by @CCCCXD), using the keypress event to allow users to use their keyboard to type numbers, and some other minor tweaks.
@BrianKTran9 жыл бұрын
Chris Merritt Great tutotial! I'm building a basic qwerty keyboard on C# Win Forms for a presentation but im kinda stumped. How would you assign each button to the actual button on a physical keyboard?
@chrismerritt72919 жыл бұрын
Brian Tran , check out 12:20 of the second part of this calculator series. It demonstrates how to use keypress events and that'll probably help you do what you're trying to do: kzbin.info/www/bejne/pWOoh4anptqksMUm20s
@BrianKTran9 жыл бұрын
Thanks Chris Merritt! Appreciate it!
@andrewharmon58439 жыл бұрын
for me the code to remove the zero if another number is typed does not work.
@andrewharmon58439 жыл бұрын
this doesn't work
@dalimmohammad16148 жыл бұрын
Thanks a lot.....:) For this app I just learn the Button control property which is much needed for me and whats I was looking for about 7 month. Now I can use the Button control setting in my application to reduce huge code. And I wanna say Thank you again. :)
@kimjongun99156 жыл бұрын
I saw a similar tutorial to make a calculator.The only difference is that the other tutorial had a million lines of code compared to yours. I guess this is a lesson on how to create efficient code. Thanks for the tutorial.
@jeffreyjohnston33688 жыл бұрын
Hey Chris, thank you very much for making this video. I have never programmed anything before and found your tutorial very helpful. I am very happy to begin learning to program! thanks again
@willhogan872910 жыл бұрын
Thanks a million Chris, fantastic tutorial. Really helped my get started in C#
@patrickhogan348710 жыл бұрын
HI Will just been messing with some sites and came across this i presume that it has something to do with facebook. talk with you soon DAD
@Theclectic10 жыл бұрын
When I start a new language, a calculator is always my first project. Thanks for the tutorial. And I didn't know could have generic events for all buttons like you did there.
@nehmimirthsnow Жыл бұрын
Wonderful Tutorial! Wasn't really building a calculator, however I wanted to make a login screen with a numeric pad. This helped me tons! Thank you!😄
@vadnegru8 жыл бұрын
if case just adds strings together(in vs 2015 it do this) just do cases like this: result.Text = (value + Double.Parse(result.Text)).ToString();
@browniqqa3 жыл бұрын
thank you friend you helped me alot
@davivify10 жыл бұрын
First, I want to thank you for your illustrative video. One suggestion I could make, especially as this is a teaching tool for new programmers, would be to use the state-machine pattern, and do the analysis before writing code! That way, when you encounter a logical error you don't end up hacking around in code - something, by the way, I know alot about. You were able to solve the problem in a few minutes because you happened to see the problem. But it's easy to get lost in code for hours. Or days. Especially when you want to expand beyond a simple 4-function calculator. You thrash around doing lots of trial-and-error, tearing up your code, introducing new bugs, and forgetting how you started. That's when they put you in a padded cell to chill out awhile ;-)
@G0nzA108957 жыл бұрын
Hey lad thanks a bunch! you're a great teacher I just started using Visual Studio and this gave me the perfect kick-start.
@briancrane76349 жыл бұрын
Last comment over a year ago. I hope you're OK and doing great! Thank You, Thank You it is always so much easier to learn by doing! I know this was a short video but it helped me a lot to get oriented to VS. Thanks!
@chrismerritt72919 жыл бұрын
+Brian Crane I'm the same way, Brian. I can read about it all day long, but until I start trying to do it myself, nothing sticks!
@sfthasim88117 жыл бұрын
Thank you .very much... This video is big helpful my study. My ICT computer class ..sir gave group work vishul studio project.
@tjokkerstar14628 жыл бұрын
dont know what i have done but after the first number and then when i click + i cant etner more then 1 number so 33 + 33 is not possible :( but 33 + 3 is.
@earljaycaoile50716 жыл бұрын
I don't know if you figured this out, but you the solution is in the last 3 minutes of the video. I just went through it and experienced the same issue.
@lalruatsangabawitlung37285 жыл бұрын
Same problem here
@Superman-hr4xl10 жыл бұрын
Chris please make more Winform application connecting to databases. Your tutorials are awesome!
@jacksongilstrap848810 жыл бұрын
How do you get those two vertical lines at 7:39? I can't find them anywhere on my keyboard.
@remzk1ng10 жыл бұрын
|| is achieved by pressing shift and \ above enter.
@jacksongilstrap848810 жыл бұрын
remzk1ng Ah, thank you.
@remzk1ng10 жыл бұрын
Jackson Gilstrap No problem!
@SubtoMementos3 жыл бұрын
Just press the shift key and press the button left to the second shift in the right side.
@ttrip867 жыл бұрын
Thanks - great tutorial! I've been having a tough time finding good Windows Forms resources.
@snoopdrg1515 жыл бұрын
wow, amazing. i've been looking for a good tutorial for a while now, i guess i can stop searching now😉
@gunn3rboi10 жыл бұрын
thanks for the video, although i already knew c# i wasn't to sure how forms worked and this video really helped me with them.
@politicaltruth424110 жыл бұрын
awesome tut...and for the noobs you can highlight all the buttons you want to apply the same click even to so you dont have to keep clicking back and forth
@tjgamer14048 жыл бұрын
Listen there is one problem with the - because every time I put a number and then - and another number, the second number restarts (really hard to explain it)
@igfxfaacvhuu17 жыл бұрын
Same here he tried to fix it but it didnt work for me I think he just copied and pasted a diffrent code so he didnt have to do it...
@RodneiJ7 жыл бұрын
This problem is solved at the end of this film .
@Macca156 жыл бұрын
You need to set the bool back to false, I believe.
@ahmedabdul-aziz69864 жыл бұрын
Stuck at 11:39 can't get the text box to work. I get an error saying button does not contain a defenition for Text
@СергейМоклоков-ф3с6 жыл бұрын
Огромное спасибо! Что говорил ни чего не понял, но видио пригодилось для создания первой программки на С#
@grootjebbink10 жыл бұрын
thnx for the good explaination but i've got one problem, i get the following message: " Error 1 Operator '-' cannot be applied to operands of type 'double' and 'string' ". I get this for the '-' , the '*' and the '/' but not for the '+' does somebody know what i'm doing wrong?
@PH-bl1bb10 жыл бұрын
very good video, clear and easy to understand. thank you for tutorial!
@chrismerritt729110 жыл бұрын
Thanks!
@StickMan13168 жыл бұрын
Chris Merritt On C++ do you know how to use the Button b = (Button) sender??
@saadsalman45188 жыл бұрын
did not get the button b = (button)sender part
@chrismerritt72918 жыл бұрын
If you look at the event handler method, sender (the component that generated the event) is generically typed as an object. Because we built the event handler and hooked it up to a button, we know that any time the event is fired that the source of the event is indeed a button. However, like I said, the sender is typed as a generic object. SO, before we can begin to talk about button properties or use button methods on our button, we first have to cast the generic object as a button. Then we can talk about the button properties for the button that caused the event to fire (and the method to be executed). Does that help?
@saadsalman45188 жыл бұрын
aah , ok , still in the learning phase , ,,, did get it now , thankz for your help
@yogendralakraj32144 жыл бұрын
Thanks for your tutoral.i was able to apply it in a similar project 👍
@madinakenzhina82649 жыл бұрын
hi! thank you so much for really claer explanation! but one detail was missed: how to work ith deciml nmbers? I mean when we press "." unfortunately it founds an error
@StaglyMusic4 жыл бұрын
u solved this?
@khizar19958 жыл бұрын
Sir thanks a lot. Just a question that can we use a label box instead of the text box?
@chrismerritt72918 жыл бұрын
Sure. I think the code would be precisely the same, presuming you named the instance of your label the same as what you (would have) named the instance of your textbox. Bother are updated by textbox.Text or label.Text. Cheers.
@fahim619110 жыл бұрын
Unable to perform Calculation for more than 2 numbers? need help immediately!
@Sniper15k78 жыл бұрын
Thank you for teaching, i'm so happy because peoples as you in youtube. :D
@megafonural10 жыл бұрын
Thanks for tutorial! Now i see how similar C# WinForms to good old Delphi 3 =)
@14mebloscianka8810 жыл бұрын
Is there any relevant difference between Convert.ToDouble() and Double.parse() methods?
@kolombiols10 жыл бұрын
nope.
@ditz3nfitness2 жыл бұрын
The comma/dot is being turned into a whole number. Any way to fix that? Like when you write 1.5 it gets turned into 15 on the label, and it also calculates/stores it like that. So if I were to do 1.5, then tap "*", and then do 3, then it would come out as 45 and not 4.5. Need it for an exam project here in 2 days
@pavankumarveerla63658 жыл бұрын
thank u chris meritt....it is helpful for my mini project ........thank u sooo much
@MrCman41110 жыл бұрын
I'm currently doing a lab on this using visio studio 2010 but the problem is my button click code uses handlers and yours does not. Any reasons as to how i can overcome this because then the code is different to yours
@chrismerritt729110 жыл бұрын
Hey Caleb, Not sure I'm following you.. What do you mean by your button click code uses handlers and mine doesn't? If you want to send me your project, i will take a look. Send it to cmerritt [at] richmond [dot] [edu] .
@MysteriousMadnessOfficial10 жыл бұрын
Thank you! :) Can't believe I did it :D You gave perfect explanation to it all so it was perfectly understandable. :) Again thank you so much. Great job
@ebros28984 жыл бұрын
I did exactly what you did on Visual Studio 2019 but my calculator appends everything. Can you please tell me how to fix that?
@darren80639 жыл бұрын
Can i ask something ? i`m new at this what`s the "Parse" is use for ? can u tell me please
@Ahmed-nr6wc7 жыл бұрын
Thanks mate, you explained everything clearly.
@cramo1234510 жыл бұрын
Thanks dude your really good at explaining things.
@bonnistripe7 жыл бұрын
Thank you very much! This video helped me with my homework.
@stanleyoverby41799 жыл бұрын
Great tutorial Chris. i'm looking forward to the next part. I would like to add some more buttons on mine to include feet & inches as well as some other construction calculations such as slope, rise & run. Not sure if you touch on that in any of your other videos. One other question, i noticed that you did not have private void Form1_Load(object sender, EventArgs e) { } under the Form 1 class but when i took it out i got an error message that would not allow me to display the form until i put it back in. Am i missing something?
@chrismerritt72919 жыл бұрын
+Stanley Overby If you have Form1_Load specified in the form designer (the lightning bolt) for the Load event of your form, and you deleted the method, that could cause your program to not compile, and will make the designer freak out too. That's probably what happened in your case. To fix that, go into the design view, click on your form, then in the properties pane, click on the lightning bolt. If you see a handler specified for the even Load, then just remove it. Then, you can go to your code-behind and remove that handler. Hope this helps.
@rbnxleadln8 жыл бұрын
if you get the answer example of 13 then you would press 2 to make 2 x 2 =4 will it just do 132 instead or reseting to 2?
@laureng333810 жыл бұрын
Can you help please? I can't use the generic command for all buttons so I had to do the numbers individually and it worked fine. Now I am on + - * / and I have no idea how to code it individually!!!
@SSJfraz8 жыл бұрын
Please help. When i'm using "||" it tells me its an invalid expression term. Am I doing it wrong?
@chrismerritt72918 жыл бұрын
Paste that portion of your code so I can see exactly what you have.
@SSJfraz8 жыл бұрын
Hey, thanks for the reply. Was missing a closing bracket. Problem solved now. Thanks!
@Jaydin1Jordan210 жыл бұрын
I made this in Visual Studio 2013, and it didn`t work. Then I looked in the description and it said to use 2012, 2010, 2008, and 2005. Any fixes that you can give me?
@Blarp299 жыл бұрын
Works fine for me, make sure you're in a C# project, not VB
@quinnhuntsman55317 жыл бұрын
Chris Merrit hello I cannot see on my CE button when I change the text to CE it only displays the C...I set my font size to the same as yours so I'm not sure what's going on
@seviperix8 жыл бұрын
have an issue, after I press for example number 1 and than the operator "+", the next number i want to type in shows up right next to the frist number so in the text box stands than for example 12+ but after I pressed the operator I cant get a number so I have a calc that cant calculate can u help me out plz?
@MarcoAntonio-wi4pb7 жыл бұрын
Muito bom a forma que você desenvolveu os códigos. Muito obrigado pela aula
@hassanbzahid7 жыл бұрын
Can you suggest how we can do Test Driven Development for this calculator app ? Any approach you can suggest ?
@mcgrann899 жыл бұрын
For those struggling with making this application run, make sure you have a double bracket at the start and end of this line: if ((result.Text == "0")||(operation_pressed)) I have noticed a few comments and thought this might help!
@56darren3 жыл бұрын
I have a question how would you do 1/x, x^2, and the sqrt function? Thanks
@thetrialshot9 жыл бұрын
hey mine says "The field 'WindowsFormsApplication1.Form1.operation_pressed' is assigned but its value is never used"
@bishalsenhdri76558 жыл бұрын
So NICE to see this Tutorial.. Thank you so much!
@ryanjohnson51509 жыл бұрын
What would you do to stop the user being able to enter multiple decimals at a time, brilliant guide !
@chrismerritt72919 жыл бұрын
+ryan johnson I think I showed how to do that in one of the follow-up videos. Basically, anytime the decimal is pressed, check to see if the value in the text box ends with a decimal. If it does, then don't add a second decimal.
@ScienceArtCrafts8 жыл бұрын
in DOT button click event simply use if (!textBox.Text.contains(".")) textBox.Text += "." ; obviously you would have to check if the button pressed is actually DOT when using generic function
@rajanshrestha54218 жыл бұрын
thank you so much sir...you helped to finish my homework :)
@jomarphilipracimo10983 жыл бұрын
can someone help me? for some reason the bool variable which is operation_presses is never read i dont iknow why i put them in the same variable as double value and string operation
@anishvarmaadduri15518 жыл бұрын
I did the same program with ASP.NET C# , But i am getting a error at clearing the textbox for entering a new number when a operator is clicked. i dont know why it happend i think i am not able to clear the textbox for entering a new number . Can you please help me with that
@chengdelee30786 жыл бұрын
The most great tutorial I ever seen
@YoungDragonLiveGamer8 жыл бұрын
y every time i try to put operator_click in the click thing in properties it says property value is not valid plz help Chris Merritt or the public
@KuyaKuysz4 жыл бұрын
..sir where can i download the application u are using in this video.
@geezgus4 жыл бұрын
kzbin.info/www/bejne/fZm0lZ9_e96fh5o here. watch this, my friend :)
@gmilrod8 жыл бұрын
Thanks Chris..many greetings from Jpn..more VC++ tutoriales plz.Adios.
@songsakchavasupakul531610 жыл бұрын
Thank you so much :) I'm new for C#
@bilalalam53109 жыл бұрын
i am new to programming so i want to ask that,once you have made the program, to open it you have to open the c# source file and run it through VS but how would i make a shortcut for it on desktop like normal applications,just click the shortcut and the calculator appears (not with the code file)? thankyou
@honesty95768 жыл бұрын
when i do 5+5 the answer is 60. it's like 55+5. what have i did wrong?
@keanu853910 жыл бұрын
Umm, I'm having a problem, when I click a button, it only allows me to put one number in. How can I fix this?
@xRMxTrojans10 жыл бұрын
Instead of using just an equal sign, use like textBox1.Text += 1; so it adds another character on.
@sualokin6910 жыл бұрын
I check all of my code to yours and it matched up exactly. I get an error in the if statement though. (Method name expected) What does this mean and how can i fix it?
@chrismerritt729110 жыл бұрын
nik sloop , Probably a curly brace that's out of whack. Make sure for every { you have a } and vice versa.
@jeanettemariano138610 жыл бұрын
hello Mr. Chris. I'm not sure if you missed it or something I think you forgot to teach how to code the "." of the calculator. the decimal point?
@one.threeh5916 Жыл бұрын
អរគុណសម្រាប់វីដេអូមួយនេះ ❤️️
@MarcRitzMD8 жыл бұрын
Chris, what was the reasoning for choosing Windows Forms over WPF?
@bilalalam53109 жыл бұрын
wow,i really appreciate your way of explaining every singly thing although minute,like you explained why did you use bool operator_pressed,keep it up :)
@reezonsharma1065 жыл бұрын
Thanks a lot ,It's very helpful .
@carenvaneeden121210 жыл бұрын
How will this differ from making a game like suduko?
@neojalaly9 жыл бұрын
sir can you please tell my how to publish this calculator i mean to create a setup file
@chrismerritt72919 жыл бұрын
saaqib riyaz Check out this link: learn.flexerasoftware.com/content/IS-EVAL-InstallShield-Limited-Edition-Visual-Studio. Depending on what version of VS you have, you may need it. But it's super easy, wizard based. For something like this, the features they provide with the full version aren't needed. They have a video on this page as well that walks you through using it. learn.flexerasoftware.com/content/IS-EVAL-InstallShield-Limited-Edition-Visual-Studio
@neojalaly9 жыл бұрын
sir i try but this error come 1. Error 3 -3204: Cannot extract icon with index 0 from file E:\cal final\calculator saaqib\calculator saaqib\bin\Debug\calculator saaqib.exe. Please help me
@neojalaly9 жыл бұрын
when i try to publish without installsheild limited edition this error come 1. An error occured while signing:SignTool.exe not found 2.Cannot publish because a project failed to build. but my program run without any error
@imbatman97105 жыл бұрын
just for people who noticed a problem with values with a point this command fixed it for me double.Parse(result.Text, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.NumberFormatInfo.InvariantInfo);
@promocodes59625 жыл бұрын
Everything works beside one issue I have. When I run the code, that "0" at the front when you type a number is still remain. If you try to make calculation you'll get an error, the only is to clear it first before you put any number. How do I fix this please? I want to make that "0" change to number when I type.
@utubevids11009 жыл бұрын
Is it possible to build a windows form in VS using c++ instead of c#?
@GCrozariol10 жыл бұрын
I am getting a lot of errors. When I write: if (result.Text == "0") result.Clear(); The Clear word got underlined. And when I write: Button b = (Button)sender; result.Text = result.Text + b.Text; The last 'Text' word got underlined too. Am I missing an Assembly? I don't know why all this is happening, but I am sure I am writing everything as the same as this video shows. And another thing: why am I using RoutedEventsArgs instead of EventArgs?
@misalschi10668 жыл бұрын
i have a problem i have written exactly as you have written but when i want to press two digit number , i cant it just one and i ve watched till the end. please help me.
@chrismerritt72918 жыл бұрын
misalschi 10 post ur code in paste bin and share link
@misalschi10668 жыл бұрын
pastebin.com/v9tvEgW6
@misalschi10668 жыл бұрын
did you find what i messed up?
@francis53075 жыл бұрын
what using systems you have use to do this please reply on me thanks
@jagdishkumarmalhi787 жыл бұрын
how to load combobox when data gridview cell click?
@thealtero16474 жыл бұрын
On the point where double .parse is done in plus function I kept having exception error saying input string not in correct format cant solve pls help?
@ljubomamic37319 жыл бұрын
Do you also have this problem, if I type in, for example 5.6+3, result would be 59, or 5.6+3.0 it would equal 86...How to fix this?
@matteocanno8 жыл бұрын
+Ljubo Mamić put the comma and not the point
@ljubomamic37318 жыл бұрын
yea i already figured it out, thanks
@matteocanno8 жыл бұрын
Ljubo Mamić nope
@rwxstudio717310 жыл бұрын
I went to use the generic button click format for the numbers you used and it caused errors. I had deleted the code for the individual buttons though so that was probably my fault.
@chrismerritt729110 жыл бұрын
Did you get something that looks like this: s39.photobucket.com/user/oo7disco/media/screenshot_zps072eae42.gif.html ? If so, it's because you deleted the method while it was still included in the designer file for the form. The easiest way to avoid this is to go into design view, and remove the method from the event handler (lightning bolt) before you delete the code.
@rwxstudio717310 жыл бұрын
Thanks allot for your reply. Yes, that was the error I got. Didn't realize I had to delete it in the event handler as well.
@chrismerritt729110 жыл бұрын
Randy Smith , Just put a video up that describes how to get around that issue in a little more detail, and how event handlers get mapped to controls on your form. This will give you a little more insight: kzbin.info/www/bejne/oqu3ZWSee8Skea8
@IIzJoKeRzII7 жыл бұрын
for some reason i cant get the operator to show up on the screen or work at all :/ any ideas to what could be going wrong the code is below public partial class MainForm : Form { Double value = 0; String operation = ""; //bool op_pressed = false; public MainForm() { InitializeComponent(); } public void button_click(object sender, EventArgs e) { Button button = (Button)sender; textBox1.Text = textBox1.Text + button.Text; } public void op_click(object sender, EventArgs e) { Button button = (Button)sender; operation = button.Text; value = Double.Parse(textBox1.Text); //op_pressed = true; } public void ClearClick(object sender, EventArgs e) { textBox1.Text = ""; } private void EqualClick(object sender, EventArgs e) { switch(operation) { case "+": textBox1.Text = (value + Double.Parse(textBox1.Text)).ToString(); break; case "-": textBox1.Text = (value - Double.Parse(textBox1.Text)).ToString(); break; case "/": textBox1.Text = (value / Double.Parse(textBox1.Text)).ToString(); break; case "*": textBox1.Text = (value * Double.Parse(textBox1.Text)).ToString(); break; default: break; } //op_pressed = false;
@peterbuker268810 жыл бұрын
Why does my result textbox not reset when I want to type something after a calculation?
@rickylionheart45774 жыл бұрын
what if the user divide by Zero?, can you do a video explaining exception handling?