C# Programming For Beginners - Lecture 13: How to Design & Code/Program a Calculator by Using NCalc
SECourses
C# Programming For Beginners Lectures (13/14) will teach you #CSharp #programming from 0 to beginner / intermediate level. So if you have no idea about programming, if you don't know anything about #coding, or if you want to become a Software Engineer, please subscribe and follow our courses.
Discord ➡️ https://bit.ly/SECoursesDiscord Patreon ➡️ https://www.patreon.com/SECourses
Technology Playlist (30+ Tutorial / Guide / News / Review Videos) ⤵️ https://www.youtube.com/playlist?list=PL_pbwdIyffsnkay6X91BWb9rrfLATUMr3
Stable Diffusion Playlist (30+ Tutorial / Guide Videos) ⤵️ https://www.youtube.com/playlist?list=PL_pbwdIyffsmclLl0O144nQRnezKlNdx3
Please join discord, mention me and ask me any questions. Thank you for like, subscribe, share and Patreon support. I am open to private consulting with Patreon subscription.
Full playlist of this course ⤵️ https://www.youtube.com/playlist?list=PL_pbwdIyffskoSXySh0MdiayPJsBZ7m2o
You can watch for free our C# Programming, ASP .NET Core MVC programming, Machine Learning and Software Engineering related courses on our playlists page ⤵️ https://www.youtube.com/@SECourses/playlists
GitHub code repository of this course (source codes of the lectures) ⤵️ https://github.com/FurkanGozukara/CSE105-2020-introduction-to-programming
The topics that have been covered in Lecture 13:
- How to convert the sender to a button and read button content
- How to use a single click event to capture multiple button clicks and process them
- How to design and code / program a calculator with .NET Core, .NET, C# WPF
- How to focus elements / textbox
- How to delete the last character of a textbox
- How to convert the string expression of a user into a mathematical equation and obtain results in decimal form by using NCalc
- What is ObservableCollection and how to use ObservableCollection to automatically update user interface (UI) elements such as ListBox
- How to capture key events on a WPF application to execute different methods for different keys
- How to capture multiple key pressing on a WPF application and take action according to that such as AltGr and D4 = $
Introduction
Lecture 13 covered a wide range of topics related to designing and programming a calculator using .NET Core, .NET, C# WPF. The topics ranged from converting the sender to a button and reading button content, using a single click event to capture multiple button clicks and process them, designing and coding a calculator, focusing elements/textbox, deleting the last character of a textbox, converting a user's string expression into a mathematical equation, using NCalc to obtain results in decimal form, using ObservableCollection to automatically update user interface (UI) elements such as ListBox, capturing key events on a WPF application to execute different methods for different keys, capturing multiple key pressing on a WPF application and taking action according to that, such as AltGr and D4 = $. This article will provide a detailed overview of each topic.
Converting the Sender to a Button and Reading Button Content
When programming a calculator, it is essential to be able to read the content of the button that is clicked. To do this, it is necessary to convert the sender to a button. The sender is an object that represents the object that raised the event. In the case of a calculator, the sender would be the button that was clicked.
Once the sender is converted to a button, the button content can be read. The button content is the text that is displayed on the button. This text is essential because it determines what operation or number should be added to the calculation.
Using a Single Click Event to Capture Multiple Button Clicks and Process Them
When designing a calculator, it is necessary to capture multiple button clicks and process them. This can be done by using a single click event to capture all button clicks. Once the button clicks are captured, they can be processed to determine the operation or number that should be added to the calculation.
Designing and Coding a Calculator with .NET Core, .NET, C# WPF
Designing and coding a calculator with .NET Core, .NET, C# WPF is a complex process that involves many steps. First, it is necessary to design the user interface. The user interface should include all of the buttons and textboxes that will be used to perform calculations.
Once the user interface is designed, it is necessary to write the code that will perform the calculations. This code should be written using C# and should be designed to handle all of the different operations that the calculator will be able to perform.
Focusing Elements/Textbox
Focusing elements/textbox is an essential part of designing a calculator. When a user clicks on a textbox, the textbox should be focused, which means that the user can start typing immediately without having to click on the textbox again.
Deleting the Last Character of a Textbox ... https://www.youtube.com/watch?v=2-wSn1zuQ0k
419020360 Bytes