[go: up one dir, main page]

0% found this document useful (0 votes)
8 views6 pages

vb.net complete

VB.NET is an object-oriented, event-driven programming language developed by Microsoft for building various applications. The document covers key concepts such as program structure, data types, operators, control structures, OOP principles, exception handling, file I/O, multithreading, and database interaction using ADO.NET. It also touches on advanced topics like LINQ, debugging, and access modifiers.

Uploaded by

dihoncho.pro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views6 pages

vb.net complete

VB.NET is an object-oriented, event-driven programming language developed by Microsoft for building various applications. The document covers key concepts such as program structure, data types, operators, control structures, OOP principles, exception handling, file I/O, multithreading, and database interaction using ADO.NET. It also touches on advanced topics like LINQ, debugging, and access modifiers.

Uploaded by

dihoncho.pro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

📘 VB.

NET Complete Notes

📌 1. Introduction to VB.NET

 Developed by Microsoft, VB.NET is an object-oriented, event-driven language for


building Windows, Web, and mobile applications.
 Runs on the .NET Framework or .NET Core/5+.
 Successor to classic Visual Basic (VB6).

🏗 2. Structure of a VB.NET Program


vb.net
CopyEdit
Module Module1
Sub Main()
Console.WriteLine("Hello, World!")
End Sub
End Module

 Module/Class: Container for code.


 Sub Main(): Entry point.
 Console.WriteLine(): Output function.

🔠 3. Data Types

Type Description
Integer 32-bit whole number
Long 64-bit whole number
Double Double-precision float
Decimal High-precision number
String Text data
Boolean True or False
Char Single character
Date Date and time

➕ 4. Operators
 Arithmetic: +, -, *, /, Mod, ^
 Comparison: =, <>, >, <, >=, <=
 Logical: And, Or, Not, AndAlso, OrElse
 Assignment: =, +=, -=, etc.

🔁 5. Control Structures

 If-Else:

vb.net
CopyEdit
If x > 10 Then
Console.WriteLine("Greater")
Else
Console.WriteLine("Lesser")
End If

 Select Case:

vb.net
CopyEdit
Select Case grade
Case "A"
Console.WriteLine("Excellent")
Case Else
Console.WriteLine("Invalid")
End Select

 Loops:

vb.net
CopyEdit
For i = 1 To 10
Console.WriteLine(i)
Next

While x < 10
x += 1
End While

🧠 6. Subroutines and Functions


vb.net
CopyEdit
Sub Greet()
Console.WriteLine("Hello")
End Sub
Function Add(a As Integer, b As Integer) As Integer
Return a + b
End Function

 Sub: No return value.


 Function: Returns a value.

🧠 7. Object-Oriented Programming (OOP)


vb.net
CopyEdit
Class Car
Public Make As String

Sub Drive()
Console.WriteLine("Driving " & Make)
End Sub
End Class

 Encapsulation: Use of classes and access modifiers.


 Inheritance: Inherits keyword.
 Polymorphism: Overriding and overloading.
 Abstraction: Use of MustInherit and MustOverride.

📦 8. Arrays and Collections

 Arrays:

vb.net
CopyEdit
Dim arr(2) As Integer
arr(0) = 10

 Lists:

vb.net
CopyEdit
Dim names As New List(Of String)
names.Add("John")

 Dictionaries:

vb.net
CopyEdit
Dim dict As New Dictionary(Of String, Integer)
dict.Add("Age", 25)
🔌 9. Exception Handling
vb.net
CopyEdit
Try
Dim x = 10 / 0
Catch ex As DivideByZeroException
Console.WriteLine("Cannot divide by zero")
Finally
Console.WriteLine("Always runs")
End Try

🗃 10. File I/O


vb.net
CopyEdit
File.WriteAllText("file.txt", "Hello")
Dim content As String = File.ReadAllText("file.txt")

 Use System.IO namespace.

🧠 11. Multithreading
vb.net
CopyEdit
Dim t As New Threading.Thread(AddressOf DoWork)
t.Start()

Sub DoWork()
Console.WriteLine("In new thread")
End Sub

📆 12. Date and Time


vb.net
CopyEdit
Dim now As DateTime = DateTime.Now
Console.WriteLine(now.ToString("dd/MM/yyyy"))

📌 13. Windows Forms Basics


vb.net
CopyEdit
Public Class Form1
Private Sub Button1_Click(...) Handles Button1.Click
MessageBox.Show("Clicked!")
End Sub
End Class

 Drag and drop controls in the designer.


 Event-driven architecture.

🌐 14. Working with Databases (ADO.NET)


vb.net
CopyEdit
Imports System.Data.SqlClient

Dim conn As New SqlConnection("connection_string")


Dim cmd As New SqlCommand("SELECT * FROM Users", conn)
conn.Open()
Dim reader = cmd.ExecuteReader()

💡 15. Advanced Topics

 LINQ (Language Integrated Query):

vb.net
CopyEdit
Dim nums = {1, 2, 3, 4}
Dim even = From n In nums Where n Mod 2 = 0 Select n

 XML Manipulation
 Web services consumption
 Using Async and Await for asynchronous programming

🧠 16. Debugging and Deployment

 Use breakpoints, watch windows, and immediate window.


 Build EXE or MSI installers from Visual Studio.

📌 17. Access Modifiers

 Public: Accessible everywhere.


 Private: Accessible only in the same class/module.
 Protected: Accessible in derived classes.
 Friend: Accessible in the same assembly.
 Protected Friend: Combo of protected and internal.

Would you like a PDF, Word, or PowerPoint version of these notes for download or printing?

4o
Do you like this personality?

Tools

You might also like