GAD Atharva Microproject
GAD Atharva Microproject
*;
import java.awt.*;
import java.awt.Image;
import java.awt.event.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.print.*;
import javafx.print.Printer;
import java.io.*;
import java.io.IOException;
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
MITTHULALJI SARADA POLYTECHNIC, BEED
Micro Project On :-
1
“ GUI Application of Calculator ”
Under The Guidance Of :-
Prof. Sawase Mam.
For The Subject :-
GUI Application Development Using VB.Net(GAD)(22034)
Department Of
Information Technology
In Academic Year
2023-24
Submitted By:- Pande Atharva Amol (2214920144)
CERTIFICATE
This is to certify that Pande Atharva Amol from Mitthulalji Sarada Polytechnic Beed Institute Having
Enrollment no. 2214920144 has completed Micro Project of second year GUI Application Development
Using VB.Net subject having Title GUI Application of Calculator during academic year 2023-2024 The
project completed by Student under the guidance of the faculty Prof. Sawase A.A.
2
Acknowledgement
A project work of a great significance is not possible without the help of several people, directly or indirectly.
First and foremost we have immense happiness in expressing our sincere thanks to our guide, Prof.Sawase Mam
for her valuable suggestion, co-operating and continuous guidance.
We feel a deep sense of gratitude to Mr. Shaikh S.I., Head of computer science and Information Technology
department for his continuous encouragement and for developing a keen interest in the field of Information
Technology. It's our pleasure to thank Mr.Khadke R.N principal of Mitthulalji Sarada Polytechnic, and Aditya
Polytechnic. Beed, who is always a constant source of inspiration.
We are very much thankful to all our faculty members whose presence always inspires us to do better. Our
happiness culminates, when we recall the co-operation extended our friends during the completion of this
project.
3
Index
2. Certificate 2
3. Acknowledgement 3
5. Requirement 6
6. Introduction 7
7. Code 10
8. Output 14
11. Conclusion 18
4
Aim of the Project
The aim of creating a calculator project in VB.NET can serve several purposes:
1. **Learning Basic Programming Concepts**: Building a calculator helps beginners grasp fundamental
programming concepts such as variables, data types, operators, conditional statements, loops, and event
handling.
2. **Understanding User Interface Design**: Designing the calculator's user interface provides insight into
creating interactive applications using Visual Studio's drag-and-drop interface and understanding controls like
buttons, text boxes, and labels.
3. **Practicing Problem-Solving Skills**: Implementing arithmetic operations, error handling, and user input
validation within the calculator project helps sharpen problem-solving skills and logical thinking.
4. **Applying Object-Oriented Principles**: While a simple calculator may not require advanced object-
oriented programming, it provides a foundation for understanding concepts like classes, objects, encapsulation,
and inheritance, which become crucial in larger software projects.
5. **Gaining Experience with VB.NET Syntax**: Writing code for the calculator project helps learners become
familiar with VB.NET syntax, language features, and coding conventions.
6. **Preparing for More Complex Projects**: Although a calculator is a relatively simple application, the skills
acquired during its development can be transferred to more complex projects, providing a solid foundation for
future software development endeavors.
Overall, the aim of the calculator project in VB.NET is to provide a hands-on learning experience that equips
individuals with essential programming skills and prepares them for tackling more significant software
development challenges.
5
Requirements:
Sr Name of resource
Specifications Quantity
No. material
1 Computer System 8 GB RAM, Windows 10 OS 1
6
Introduction
8
Dim num1 As Double
Dim num2 As Double
Dim operand As String
TextBox1.Text = result.ToString()
End Sub
That's a very basic calculator. You can expand it by adding more features like parentheses, exponentiation,
memory functionality, etc. as you become more comfortable with VB.NET programming.
10
Code:-
Public Class calculator
11
' add click event to all button in the form
For Each c As Control In Controls
End If
Next
End Sub
Else
' if operator
If oprClickCount = 0 Then
' if we click on an operator for the first time
oprClickCount += 1
num1 = Double.Parse(TextBox1.Text)
opr = button.Text
isOprClick = True
Else
If Not button.Text.Equals("=") Then
' if the button is not "="
If Not isEqualClick Then
' if "=" is not clicked befor
num2 = Double.Parse(TextBox1.Text)
TextBox1.Text = Convert.ToString(calc(opr, num1, num2))
num2 = Double.Parse(TextBox1.Text)
opr = button.Text
isOprClick = True
isEqualClick = False
Else
isEqualClick = False
opr = button.Text
End If
Else
num2 = Double.Parse(TextBox1.Text)
TextBox1.Text = Convert.ToString(calc(opr, num1, num2))
num1 = Double.Parse(TextBox1.Text)
isOprClick = True
isEqualClick = True
End If
13
End If
End If
End Sub
End Function
Select Case op
Case "+"
result = n1 + n2
Case "-"
result = n1 - n2
Case "X"
result = n1 * n2
Case "/"
14
If n2 <> 0 Then
result = n1 / n2
End If
End Select
Return result
End Function
num1 = 0
num2 = 0
opr = ""
oprClickCount = 0
isOprClick = False
isEqualClick = False
TextBox1.Text = "0"
End Sub
End Class
Output:-
15
16
Advantages of Calculator Application
2. **Rich User Interface**: VB.NET allows developers to design visually appealing user interfaces using
drag-and-drop controls, making it easy to create a user-friendly calculator interface.
3. **Integration with .NET Framework**: VB.NET is part of the .NET Framework, which provides a
rich set of libraries and tools for building robust applications. Developers can leverage the functionalities of
the .NET Framework to enhance the capabilities of their calculator application.
5. **Access to .NET Framework Libraries** : VB.NET applications have access to a wide range of
libraries available in the .NET Framework, including math functions, which can be utilized to implement
advanced calculator functionalities.
7. **Community Support**: VB.NET has a large community of developers who contribute to forums,
tutorials, and other resources. Developers can leverage this community support to troubleshoot issues, learn new
techniques, and enhance their calculator application.
8. **Integration with Other Technologies**: VB.NET can easily integrate with other technologies and
services, such as databases, web services, and third-party APIs. This enables developers to extend the
functionality of their calculator application by incorporating additional features.
17
9. **Scalability**: VB.NET applications can scale seamlessly to accommodate growing user
demands and evolving business requirements. Developers can enhance the calculator application with new
features and functionalities as needed.
10. **Security**: VB.NET provides built-in security features, such as code access security and role-
based security, to help developers create secure calculator applications that protect user data and prevent
unauthorized access.
Overall, developing a calculator application in VB.NET offers a combination of ease of development, rich user
interface capabilities, access to a robust framework, and community support, making it a preferred choice for
many developers.
18
Disadvantages of Calculator Application
While there are numerous advantages to creating a calculator GUI application in VB.NET, there are also some
potential disadvantages to consider:
2. **Overhead**: Using a GUI framework, such as WinForms or WPF in VB.NET, introduces some
overhead in terms of memory usage and performance compared to a purely console-based application. For
simple calculator applications, this overhead may be negligible, but for extremely lightweight applications, it
could be a consideration.
3. **Learning Curve**: While VB.NET offers a relatively gentle learning curve compared to some
other programming languages, mastering GUI development can still require time and effort. Developers who
are new to VB.NET or GUI programming may find themselves spending additional time learning the necessary
concepts and techniques.
6. **Maintainability**: GUI applications, including calculator GUIs, tend to have more complex
code structures compared to console-based applications. This complexity can make the codebase harder to
maintain, especially as the application grows in size or complexity.
19
7. **Resource Consumption**: GUI applications typically consume more system resources (CPU,
memory) compared to console-based applications. While this might not be a significant concern for a simple
calculator application, it could be a consideration for developers targeting resource-constrained environments.
9. **Accessibility**: GUI applications may present accessibility challenges for users with disabilities
compared to console-based applications. Ensuring that the calculator GUI is accessible to all users may require
additional design considerations and testing.
10. **Deployment Complexity**: Deploying a VB.NET calculator GUI application may involve
additional steps compared to a console-based application, such as packaging and distributing dependencies or
ensuring that the application installs correctly on end-user systems.
While these disadvantages should be considered, they may not be significant barriers for developers creating
simple calculator GUI applications in VB.NET, especially if the primary goal is to provide basic arithmetic
functionality in a user-friendly interface.
Conclusion
Creating a calculator in VB.NET is a great way to practice programming fundamentals while building a useful
tool.
20