Create Your Own Calculator Tutorial Part 1 - C Sharp Visual Studio 2008

preview_player
Показать описание
This is part 1 of my second tutorial.

In this tutorial I will show you how to create your very own calculator similar to the windows calculator. Not only will you make a useful program but learn a lot of things that C# can do.

Download Link:





SUBSCRIBE TO MY VIDEOS
Рекомендации по теме
Комментарии
Автор

Hey there! I think it was 13 years ago when I first found this video. I was a young kid who wanted to learn programming, and this calculator was the first ever thing I've coded. Now, I am a software developer, and I can't imagine a life without coding :D So, this video kinda changed my life, so thank you so, so much for it!

NikitaKaramov
Автор

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
Автор

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 );
}

DeeGeeDeFi
Автор

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?


bluesdave
Автор

Thanks a lot!
I always wanted a calculator tutorial in C#.

puscasm
Автор

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
Автор

Thanks, , , man You are actually amazing, u Solved all of my alot once please i am new in windows Form Apps, , , can please upload Lessons from the basic of C#, please upload Ur C# tutorials, ,i will be very thankfull.

AliAhmed-plpt
Автор

This video tutorial is awesome, it works!!

How can I add to this calculator the functions, sin, cos, tan and mod?

conchig
Автор

catch the exception using "try-catch", for example:

equals_button_click()
{
try
{ // math operation
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
Автор

try to write ", " (comma) instead of "." in method: private void Decimal_Click(object sender, EventArgs e).
I think it's working now :)

alicjab.
Автор

@QuackWare
Fixed this as well
in vb2008 express you have to write the following code above ur scrip":
"dim dec as decimal"

ivo
Автор

thanx a lot QuackWare..Much needed one for me..cheers..:D

RavinduM
Автор

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.

hafizfalul
Автор

@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
Автор

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?

ivo
Автор

why my program does not work? I've followed all your instructions.. btw, mine is VS 2005. does it affects the program?

wikoo
Автор

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

navjotsingh
Автор

Do we need to make variables to operate more than 2 numbers? Please let me know

CBoozer
Автор

You can put "!" on the decimal point and delete that else.If ! have decimal point

AtanasovPetar
Автор

Thanks a lot man! it helps me greatly.

raheelbutt