Blog
10+ BEST GPU Benchmark Software in 2021
A GPU benchmark is a test that helps you to compare the speed, performance, and efficiency of the...
In this tutorial, you will learn-
A VB.NET program consists of the following:
Step 1) Create a new console application.
Step 2) Add the following code:
Imports System
Module Module1
'Prints Hello gtupapers
Sub Main()
Console.WriteLine("Hello gtupapers")
Console.ReadKey()
End Sub
End Module
Step 3) Click the Start button from the toolbar to run it. It should print the following on the console:
Let us discuss the various parts of the above program:
Explanation of Code:
In VB.NET, we use classes to define a blueprint for a data type. It does not mean that a class definition is a data definition, but it describes what an object of that class will be made of and the operations that we can perform on such an object.
An object is an instance of a class. The class members are the methods and variables defined within the class.
To define a class, we use the Class keyword, which should be followed by the name of the class, the class body, and the End Class statement. This is described in the following syntax:
[ <attributelist> ] [ accessmodifier ] _ Class name [ Inherits classname ] [ statements ] End Class
Here,
Following is example code to create a class in VB.NET -
Step 1) Create a new console application.
Step 2) Add the following code:
Imports System
Module Module1
Class Figure
Public length As Double
Public breadth As Double
End Class
Sub Main()
Dim Rectangle As Figure = New Figure()
Dim area As Double = 0.0
Rectangle.length = 8.0
Rectangle.breadth = 7.0
area = Rectangle.length * Rectangle.breadth
Console.WriteLine("Area of Rectangle is : {0}", area)
Console.ReadKey()
End Sub
End Module
Step 3) Run the code by clicking the Start button from the toolbar. You should get the following window:
We have used the following code:
Explanation of Code:
A structure is a user-defined data type. Structures provide us with a way of packaging data of different types together. A structure is declared using the structure keyword. Example to create a structure in VB.NET:
Step 1) Create a new console application.
Step 2) Add the following code:
Module Module1
Structure Struct
Public x As Integer
Public y As Integer
End Structure
Sub Main()
Dim st As New Struct
st.x = 10
st.y = 20
Dim sum As Integer = st.x + st.y
Console.WriteLine("The result is {0}", sum)
Console.ReadKey()
End Sub
End Module
Step 3) Run the code by clicking the Start button from the toolbar. You should get the following window:
We have used the following code:
Explanation of Code:
IDE stands for Integrated Development Environment. It is where we write our code. Microsoft Visual studio forms the most common type of IDE for VB.NET programming.
To install Visual Studio use this guide.
To write your code, you need to create a new project. The following steps can help you achieve this:
Step 1) Open Visual Studio, and click the File menu, Choose New then Project from the toolbar.
Step 2) On the new window, click Visual Basic from the left vertical navigation pane. Choose Window Forms Application.
Step 3) Give it a name and click the OK button. The project will be created.
You will have created a Windows Form Application project. This type of project will allow you to create a graphical user interface by dragging and dropping elements.
You may need to create an application that runs on the console. This requires you to create a Console Application project. The following steps can help you achieve this:
Step 1) Open Visual Studio, and click the File menu, Choose New then Project from the toolbar.
Step 2) On the new window, click Visual Basic from the left vertical navigation pane. Choose Console Application.
Step 3) Give it a name and click the OK button. The project will be created.
A GPU benchmark is a test that helps you to compare the speed, performance, and efficiency of the...
Here are computer science interview questions for fresher as well as experienced candidates to get...
In this tutorial, you will learn select() Filter() Pipeline arrange() The library called dplyr...
Software engineering is defined as a process of analyzing user requirements and then designing,...
New Relic's is a leading tool for application performance monitoring (APM). It offers real-time...
Following are frequently asked questions in interviews for freshers as well as experienced Java...