(Part 3) Visual Studio Winform Windows Calculator Tutorial Example (C#)

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ม.ค. 2025

ความคิดเห็น •

  • @sharthakghosh970
    @sharthakghosh970 10 ปีที่แล้ว +1

    i think your one of the best people on youtube who describe so well

  • @chrismerritt7291
    @chrismerritt7291  10 ปีที่แล้ว +14

    Sorry the audio sucks; think the baby monitor was interfering w/ my mic. I think it's OK to hear, but you may have to turn your volume up. Sorry bout that.

  • @camerongoss4553
    @camerongoss4553 8 ปีที่แล้ว

    Thank you for an excellent tutorial. This really helped me so much with coming to grips with the basics of c# programming and correctly using classes. I used a class library and referenced it to my project so that i can use the library for future projects. Very useful, thanks again!

  • @brianennis7102
    @brianennis7102 10 ปีที่แล้ว

    i got it working after all thanks Chris now i have a fully working calculator

  • @karstenmeurer8904
    @karstenmeurer8904 10 ปีที่แล้ว

    Great tutorial, thanks for sharing!
    I have noticed that the sqrt function is a little buggy if you were doing some math in the beginning and want to add the root of a number. I often get weird behavior, especially when I do another operation after that. Now, I fixed this by moving everything after the handling of a sqrt in the case value != 0 into an "else" case.
    My code looks like this:
    if (b.Text == "sqrt")
    result.Text = Math.Sqrt(Double.Parse(result.Text)).ToString();
    else
    {
    equals.PerformClick();
    operation_pressed = true;
    operation = b.Text;
    equation.Text = value + " " + operation;
    }

  • @veselinastoyanova2319
    @veselinastoyanova2319 9 ปีที่แล้ว +1

    Hi Chris Merritt, why does the program throw an exception when i try to calculate something like 3.5*...?

  • @opc1302
    @opc1302 10 ปีที่แล้ว +1

    in case you divide by 0, how did you use the exception System.DivideByZeroException ?

  • @youlaferro
    @youlaferro 10 ปีที่แล้ว +1

    numbers are appending to the result after an arithmetical expression has been made ex
    3 +1 = 4 then I press some arbitrary number 11 for ex result is now 411.
    help to correct, please.

  • @stanleyoverby4179
    @stanleyoverby4179 9 ปีที่แล้ว

    +Chris Merritt
    ok, i was doing pretty good to the very end. in my form1.cs under the private void operator_click where im trying to type Result.Text = Operators.sqrt(Double.Parse(Result.Text)).ToString(); im getting an error that says the best overloaded method match has some invaled arguments. also what am i supposed to put under the Operator.cs for
    public static int sqrt(int n1, int n2)
    {
    return Math.Sqrt(n1);/i dont know what to put here?
    }
    public static Double sqrt(int n1)
    {
    return Math.Sqrt(n1);//i dont know what to put here?
    }
    i'm probably going to have to watch this again. I got lost at the end

    • @stanleyoverby4179
      @stanleyoverby4179 9 ปีที่แล้ว

      +Stanley Overby i figured it out. i had int where i was supposed to have double in the operator class program. i would like to learn how to add in feet and inches buttons & also slope, rise & run, i want to be able to add 6feet 4 inches + 4 feet 2 inches & have it return the correct result. I have a mobile app that does this

  • @Bigkwan1220
    @Bigkwan1220 10 ปีที่แล้ว

    Any Idea on how to create a Conversion radio button in a groupbox to toggle the result as a binary or decimal. Thanks

  • @404_sail
    @404_sail 4 ปีที่แล้ว

    what is syntex of button 'CE'

  • @bernardopower5267
    @bernardopower5267 2 ปีที่แล้ว

    How do u do code with other unary operators eg sin cos tan….?

  • @tashreen.al-absi2768
    @tashreen.al-absi2768 6 ปีที่แล้ว

    thank you..very nice videos

  • @carlosvasquez8491
    @carlosvasquez8491 8 ปีที่แล้ว

    Hi. Is there any way I can get a link to the vidio where you start building the calculator from zero? Thanks!

    • @chrismerritt7291
      @chrismerritt7291  8 ปีที่แล้ว

      th-cam.com/video/Is1EHXFhEe4/w-d-xo.html

    • @carlosvasquez8491
      @carlosvasquez8491 8 ปีที่แล้ว +1

      Thank you Chris. You rock! I´m taking programming classes at University and your videos have helped me a lot. Please keep sharing your knowledge.

  • @arnoid11
    @arnoid11 10 ปีที่แล้ว

    microsoft's calculator can show numbers upto infinite in the label. how to do this?

  • @s1nister688
    @s1nister688 10 ปีที่แล้ว

    OK how and from where u added these codes and did it work.I think u missed a video to post.I am not understanding what u are showing.Please show

  • @yonatanassayag2196
    @yonatanassayag2196 8 ปีที่แล้ว

    i tried to make the equal be pressed when i press the enter key but it's not working, and i notice that if i click with the mouse on the result line i can type there every thing how can i cancel that?

    • @kingdarius3129
      @kingdarius3129 8 ปีที่แล้ว

      click on textbox, go to properties, change ReadOnly to True.

    • @shittyvideostudios8584
      @shittyvideostudios8584 8 ปีที่แล้ว

      King Darius You just got me an extra 3% on my grade, thanks!

  • @SintaxErorr
    @SintaxErorr 10 ปีที่แล้ว +1

    The answer cant be a decimal ?? Plz help

  • @georgewright7549
    @georgewright7549 10 ปีที่แล้ว +1

    Can you make a video about how to save project and how to strart it without visual studio

    • @kewlceo
      @kewlceo 9 ปีที่แล้ว

      +george wright Hi George, just go into your Win_Calc\bin\Debug folder and locate the exe file. That is all you need. You can send that single file to another Windows computer and the calculator will run.

  • @abdulrahmanrefaei1023
    @abdulrahmanrefaei1023 8 ปีที่แล้ว

    do you have a original file to download, pls?

  • @Sakyawirananda
    @Sakyawirananda 9 ปีที่แล้ว

    hello there. thanks for the videos. it helps me a lot.... I am a beginner and I can understand your tutorial. btw I want to know how to change the color of the X/O text. I tried changing the forecolor but it doesnt seems to do anything.

    • @chrismerritt7291
      @chrismerritt7291  9 ปีที่แล้ว

      Sakyawira Nanda Ruslim, Forecolor is the right value to change. I just opened the project and opened Form1 in design mode, selected button A1, and then went over to properties and change the forecolor to a different color. That worked for me. I changed it to red. Then when I mouse over the button, the X or O is red.

    • @Sakyawirananda
      @Sakyawirananda 9 ปีที่แล้ว

      Chris Merritt hmmm thanks for replying. I'll try that again. But Any ideas why that doesnt work?

    • @chrismerritt7291
      @chrismerritt7291  9 ปีที่แล้ว

      Not unless you are overriding the forecolor value of the button somewhere else in your code? Do a search for "forecolor" in your code behind and see if you find anything. It's been a while since I did this, so I can't recall if we manually set forecolor somewhere or not.

  • @mitchs1527
    @mitchs1527 8 ปีที่แล้ว

    How would you add the operation of x^2 ?

    • @heisenbergb.damned8461
      @heisenbergb.damned8461 8 ปีที่แล้ว

      Just take the current value in the input field and multiply by itself. The windows calculator works like this so, for example, 5 ^2 =25 (because 5 * 5 = 25) and 5 + 5 ^2 = 30 (because 5 + (5 * 5) = 30) it's only reading the current input field and multiplying by itself.

  • @xoro91g
    @xoro91g 9 ปีที่แล้ว +1

    Hi Dear. Thank you for videos. They help me a lot. But you have a few mistakes.
    For example you don't need two methods for each operator, because "value" always is double type

  • @phuocdang6979
    @phuocdang6979 8 ปีที่แล้ว

    you can help me to button MC,MS,MR??

    • @heisenbergb.damned8461
      @heisenbergb.damned8461 8 ปีที่แล้ว

      Old comment I know but in case you come back to read this really all you need to do is have a variable store your memory value when you hit MS, recall that variable when you hit MR and zero it when you hit MC.

  • @datvu4681
    @datvu4681 7 ปีที่แล้ว

    you can give me the code file does not?

  • @kenpcmusic5575
    @kenpcmusic5575 8 ปีที่แล้ว

    Hi! simple code for sqrt: private void button1_Click(object sender, EventArgs e)
    {
    double sq = Double.Parse(textBox_Results.Text);
    labelcurrentOperation.Text = System.Convert.ToString("sqrt" + "(" + (textBox_Results.Text) + ")");
    sq = Math.Sqrt(sq);
    textBox_Results.Text = System.Convert.ToString(sq);

    • @agenttickle6412
      @agenttickle6412 7 ปีที่แล้ว

      Wow that's a lot easier. Thanks!

  • @bratal2
    @bratal2 10 ปีที่แล้ว

    when i use "sqrt" and than i use for example + there is error

    • @bratal2
      @bratal2 10 ปีที่แล้ว

      or if I try to use "sqrt" after any other function

  • @brianennis7102
    @brianennis7102 10 ปีที่แล้ว

    can some one please help me please i have calculator working but if i enter 9 for sqrt i get 9 back it should be 3 like in the video. my code is identical i cant figure it out
    can some please help me thanks

  • @1453Teko
    @1453Teko 8 ปีที่แล้ว

    Fail. 0 didt work.

  • @krimbelkacem5751
    @krimbelkacem5751 10 ปีที่แล้ว

    the audio realy sucks
    what are you waiting to make it again, i'm just kidding thank you
    please make us a real app with a local database
    thank you

    • @chrismerritt7291
      @chrismerritt7291  10 ปีที่แล้ว

      It does suck, sorry!! Anything in particular you're looking for in terms of local DB app?

    • @krimbelkacem5751
      @krimbelkacem5751 10 ปีที่แล้ว

      i'am looking to a tutorial where we you make us an app a pos (point of sells) for example that has db that you can install in one click and you can print the receipt and the products that you bought
      thank you very much

  • @ChaimMosheStern
    @ChaimMosheStern 10 ปีที่แล้ว

    i cant hear anything
    the other videos was much better

  • @SintaxErorr
    @SintaxErorr 10 ปีที่แล้ว

    The answer cant be a decimal ?? Plz help