Visual Programming 1
Visual Programming 1
It is a combination of tools like a code editor, code compiler, and code debuggIntegrating features
like software editing, building, testing, and packaging in a simple-to-use tool, IDEs help boost
developer productivity.
IDEs are commonly used by programmers and software developers to make their programming
journey smoother with an integrated terminal.
Editor: Typically a text editor can help you write software code by highlighting syntax with
visual cues, providing language-specific auto-completion, and checking for bugs as you type.
Compiler: A compiler interprets human-readable code into machine-specific code that can
be executed on different operating systems like Linux, Windows, or Mac OS. Most
IDEs usually come with built-in compilers for the language it supports.
Debugger: A tool that can assist developers to test and debug their applications and
graphically point out the locations of bugs or errors if any.
Build-in Terminal: Terminal is a text-based interface that can be used for interacting with the
machine’s operating system. Developers can directly run the scripts or commands within an
IDE with a built-in terminal/console.
Version Control: Version control helps bring clarity to the development of the
software. Some IDEs also support version control tools like Git, through which a user can
track and manage the changes to the software code.
Code snippets: IDEs support code snippets that are usually used to accomplish a single task
and can also reduce redundant work to some great extent.
Extensions and Plugins: Extensions and Plugins are used to extend the functionality of the
IDEs with respect to specific programming languages.
Code navigation: IDEs come with tools like code folding, class and method navigation, and
refactoring tools that make it simple to go through and analyze code.
By providing a single, unified environment for managing all aspects of the development
process, IDEs can help improve a developer’s productivity, code quality, and overall
development experience.
Code Quality: IDEs come with built-in tools as a part of a single GUI, through which
developers can execute actions without switching between applications. Furthermore, it can
also help in Syntax highlighting, code refactoring, and code analysis boosting overall code
quality.
Integrated Environment: IDEs come pre-built with a combination of development tools that
allow developers to start programming new applications quickly. With IDEs, it is no longer
necessary to manually configure and integrate numerous utilities as part of the setup
procedure. Additionally, since every utility is available on the same workbench, developers
don’t have to spend hours learning how to use each one separately.
Types of IDEs
IDEs come in various forms, some are designed to work for a specific language whereas some
are targeted to a particular platform like mobile devices. Hence, it becomes equally
important to choose an IDE best suited to one’s needs.
1. Desktop IDEs
This type includes the IDEs that can be configured locally. They do not need an active
internet connection to build/run programs. Desktop IDEs are highly customizable to suit
developer-specific needs and provide performance irrespective of the internet speed.
Examples: include Microsoft Visual Studio, Eclipse, Netbeans, etc.
2. Cloud IDEs
Cloud IDEs eliminate the overhead of configuring the software locally. They run on remote
servers and can be accessed through desktop browsers. Cloud IDEs provide better
accessibility and platform independence making them accessible through the Internet
Irrespective of the Client Operating System. Cloud IDEs can be used freely or can have pricing
models with respect to the provider. Examples: Include Gitpod, AWS Cloud 9, Replit, etc.
These IDEs are specially designed for creating mobile applications. They include features like
Emulator support and integration for developing and testing mobile applications. Mobile
Development IDEs can be in the form of Desktop IDE or Cloud IDE. Examples: Include
Android Studio, Flutlab.io, etc.
4. Database-Specific IDEs
These IDEs (Integrated Development Environments) are specially designed for working with
databases. They include features like query builders and n for developing and testing mobile
applications. Like mobile-development IDEs, Database IDEs can also be in the form of
Desktop IDE or Cloud IDEs. Examples: Include MySQL Workbench, Oracle SQL Developer, etc.
Project Management: IDEs make viewing the project directory structure much simpler which
breaks down the tedious tasks of working with multiple files. Typically IDEs also include a
number of tools, such as syntax highlighting, code completion, and code folding, which
makes it easier to manage the overall project.
Saving plenty of time and Effort: IDEs often include a variety of tools that can not only assist
you in organizing your code but also quickly highlight the error in your code. They also
include a flexible combination of tools for compiling, building, testing, and deploying your
code, through which you can automate these tasks eliminating the need to manually run
each task.
Productivity: IDEs can increase your productivity by providing a centralized location for all of
your development needs, from writing and editing code to debugging and deploying. Some
of the functionality provided by IDEs can also be accomplished with a text editor and
command-line tools, but IDEs usually make the process more convenient and user-friendly.
Not beginner Friendly: IDEs are complex tools and generally provide quite an intimidating UI,
which can be a little tough to comprehend for a beginner. Maximizing their benefit generally
needs a dedicated effort.
Frequent Updates: It’s difficult to keep up with constant updates, such as new samples,
templates, and features.
Only Assist in writing code: As a tool, IDEs (Integrated Development Environments) are
limited to being an assistant. They can’t write code or automatically fix errors, one still needs
the knowledge to write clean code.
Cost: Some IDE is Expensive or needs additional costs to unlock some add-ons, which can be
a barrier for small-scale companies or learning Individuals.
Conclusion
Choosing an IDE is usually determined by the type of project you’re working on, as well as
various environmental requirements; offering a variety of features such as code editing,
debugging, and version control that can streamline and increase productivity in the software
development process. Of course, you still must consider your budget and personal
preferences. Overall, the use of IDEs can assist individuals or businesses in improving their
software development process, resulting in shorter time-to-market, cost savings, and higher
software quality.
FORMS:
A Form uses a System.Windows.Form namespace, and it has a wide family of controls that
add both forms and functions in a Window-based user interface.
Form Properties
The following are the most important list of properties related to a form. And these
properties can be set or read while the application is being executed.
Properties Description
Cursor It is used to set the cursor image when it hovers over the form.
AllowDrop Using the AllowDrop control in a form, it allows whether to drag and
drop on the form.
MinimizeBox MinimizeBox It is used to display the minimum option on the title bar of
the form.
IsMDIChild It is used to authenticate whether a form is a container of a Multiple
Document Interface (MDI) child form.
MaximizeBox It is used to display the maximum option on the title bar of the form.
MaximumSize It is used to set the maximum height and width of the form.
AcceptButton It is used to set the form button if the enter key is pressed.
Top, Left It is used to set the top-left corner coordinates of the form in pixel.
MinimumSize It is used to set the minimum height and width of the form.
Enabled It uses the True or False value to enable mouse or keyboard events in
the form.
TopMost It uses a Boolean value that represents whether you want to put the
window form on top of the other form. By default, it is False.
Form Events
The following are the most important list of events related to a form.
Events Description
Activated An activated event is found when the user or program activates the
form.
DoubleClick DoubleClick
The DoubleClick event is activated when a user double clicks on the
form.
GotFocus A GotFocus event is activated when the form control receives a focus.
KeyUp A KeyUp event is activated when a key is released while focusing on the
form.
Load The load event is used to load a form before it is first displayed.
MouseEnter A MouseEnter event is activated when the mouse pointer enters the
form.
MouseHover A MouseHover event is activated when the mouse pointer put on the
form.
MouseLeave A MouseLeave event is activated when the mouse pointer leaves the
form surface.
Shown It is activated whenever the form is displayed for the first time.
For creating a Windows Forms application , we need to follow the following steps in
Microsoft Visual Studio.
And finally, click on the 'Create' button to create your project, and then, it displays the
following window form with a name Form1.
Form1.vb
6.
7. End Sub
8. ' It is Label1
10.
14.
18.
20.
25. Label3.Text = "You have entered the Name " & nameStr + " Number " & num
26.
28.
31.
35.
Output:
Now enter the following details in the form:
After filling all the details, click on the Submit button. After that, it shows the following
Output:
Control Properties
All the Visual Basic Objects can be moved, resized or customized by setting their properties.
A property is a value or characteristic held by a Visual Basic object, such as Caption or Fore
Color.
Properties can be set at design time by using the Properties window or at run time by using
statements in the program code.
Where
For example,
Form1.Caption = "Hello"
You can set any of the form properties using Properties Window. Most of the properties can
be set or read during application execution. You can refer to Microsoft documentation for a
complete list of properties associated with different controls and restrictions applied to
them.
Control Methods
If you are using a control such as one of those provided by the Toolbox, you can call any of its
public methods. The requirements of such a method depend on the class being used.
If none of the existing methods can perform your desired task, you can add a method to a
class.
For example, the MessageBox control has a method named Show, which is called in the code
snippet below −
Handles Button1.Click
MessageBox.Show("Hello, World")
End Sub
End Class
Control Events
An event is a signal that informs an application that something important has occurred. For
example, when a user clicks a control on a form, the form can raise a Click event and call a
procedure that handles the event. There are various types of events associated with a Form
like click, double click, close, load, resize, etc.
Following is the default structure of a form Load event handler subroutine. You can see this
code by double clicking the code which will give you a complete list of the all events
associated with Form control −
End Sub
Here, Handles MyBase.Load indicates that Form1_Load() subroutine handles Load event.
Similar way, you can check stub code for click, double click. If you want to initialize some
variables like properties, etc., then you will keep such code inside Form1_Load() subroutine.
Here, important point to note is the name of the event handler, which is by default
Form1_Load, but you can change this name based on your naming convention you use in
your application programming.
Basic Controls
VB.Net provides a huge variety of controls that help you to create rich user interface.
Functionalities of all these controls are defined in the respective control classes. The control
classes are defined in the System.Windows.Forms namespace.
Sr.No
Widget & Description
.
Forms
1
The container for all the controls that make up the user interface.
TextBox
2
It represents a Windows text box control.
Label
3
It represents a standard Windows label.
Button
4
It represents a Windows button control.
ListBox
5
It represents a Windows control to display a list of items.
6 ComboBox
It represents a Windows combo box control.
RadioButton
7 It enables the user to select a single option from a group of choices
when paired with other RadioButton controls.
CheckBox
8
It represents a Windows CheckBox.
PictureBox
9
It represents a Windows picture box control for displaying an image.
ProgressBar
10
It represents a Windows progress bar control.
ScrollBar
11
It Implements the basic functionality of a scroll bar control.
DateTimePicker
ListView
EVENTS:
Following are the various keyboard events related with a Control class −
KeyDown − occurs when a key is pressed down and the control has focus
KeyPress − occurs when a key is pressed and the control has focus
KeyUp − occurs when a key is released while the control has focus
The event handlers of the KeyDown and KeyUp events get an argument of
type KeyEventArgs. This object has the following properties −
Modifiers − it indicates which modifier keys (Ctrl, Shift, and/or Alt) are pressed
The event handlers of the KeyDown and KeyUp events get an argument of type
KeyEventArgs. This object has the following properties −
In Visual Basic , properties are special member variables that provide controlled access to an object’s
data.
Properties allow us to get and set the values of private fields while encapsulating the internal details
of the class.
There are some common types of properties in VB.NET. Properties are essential for encapsulating
data and providing controlled access to class members, promoting good object-oriented
programming practices and data encapsulation.
1. Get Property (Read-Only Property):A get-only property allows us to retrieve the value of a private
field but doesn’t allow us to modify it.
For Example:-
Get
Return first_name
End Get
End Property
2. Set Property (Write-Only Property):
A set-only property allows us to set the value of a private field but doesn’t allow us to retrieve it.
For Example:
Set(value As Integer)
age = value
End Set
End Property
A get-set property allows both getting and setting the value of a private field.
For Example:
Get
Return last_name
End Get
Set(value As String)
Last_Name = value
End Set
End Property
Auto-Implemented Property:
An auto-implemented property is a shorthand syntax for creating properties when we don’t need
additional logic in the getter or setter. The compiler generates the private field for us.
For Example:
For Example:
Public ReadOnly Property Str As String
For Example:
Indexed Property:
For Example:
Get
Return items(index)
End Get
Set(value As String)
items(index) = value
End Set
End Property
Default Property:
A default property allows us to access an object using an index or key without specifying the
property name.
Example:
Get
Return items(index)
End Get
Set(value As String)
items(index) = value
End Set
End Property
A shared property is associated with the class itself rather than with instances of the class.
For Example:
Custom Properties:
We can create our own custom properties with additional logic in the getter or setter to perform
validation, calculations, or other operations as needed.