SlideShare uma empresa Scribd logo
1 de 19
Baixar para ler offline
VB.Net Programs
Prof. K. Adisesha 1
C# & Dot Net Lab Programs
Part- B
1. VB.net Program to count the number of Vowels in a string
Public Class Form1
Private Sub resultBtn_Click(sender As Object, e As EventArgs) Handles resultBtn.Click
Dim str1, str2 As String
Dim vcount, i, str1len As Integer
vcount = 0
str1 = stringText.Text
str1len = Len(str1)
str1 = LCase(str1)
For i = 1 To str1len
str2 = Mid(str1, i, 1)
If str2 = "a" Or str2 = "e" Or str2 = "i" Or str2 = "o" Or str2 = "u" Then
vcount = vcount + 1
End If
Next i
resultText.Text = vcount
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Close()
End Sub
End Class
VB.Net Programs
Prof. K. Adisesha 2
Output:
VB.Net Programs
Prof. K. Adisesha 3
2. VB.net Program to Check a given is Even or Odd Number or Overflow
if number>10000
Code:
Public Class Form1
Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles resultBtn.Click
If valueText.Text Mod 2 = 0 Then
resultText.Text = "EVEN"
Else
resultText.Text = "ODD"
End If
If valueText.Text > 10000 Then
resultText.Text = "Overflow!!!"
End If
VB.Net Programs
Prof. K. Adisesha 4
End Sub
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
valueText.Text = ""
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Close()
End Sub
End Class
Output:
VB.Net Programs
Prof. K. Adisesha 5
3. VB.net Program to calculate the compound interest
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles resultBtn.Click
Dim P As Integer
Dim R As Integer
Dim n As Integer
P = principleText.Text
R = rateText.Text
n = timeText.Text
compText.Text = P * (1 + (R / 100)) ^ n - 1
End Sub
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles btnExit.Click
Close()
End Sub
VB.Net Programs
Prof. K. Adisesha 6
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
principleText.Text = ""
rateText.Text = ""
timeText.Text = ""
End Sub
End Class
Output:
VB.Net Programs
Prof. K. Adisesha 7
4. VB.Net Program to Display the sum of Positive and negative numbers
using input box
Code:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub resultBtn_Click(sender As Object, e As EventArgs) Handles resultBtn.Click
Dim arr(), a, b, c, i As Integer
a = CInt(limitText.Text)
ReDim arr(a)
For i = 0 To a - 1 Step 1
arr(i) = CInt(InputBox("Enter elements:"))
If arr(i) > 0 Then
b = b + arr(i)
ElseIf arr(i) < 0 Then
c = c + arr(i)
End If
Next
positiveText.Text = b
negativeText.Text = c
End Sub
VB.Net Programs
Prof. K. Adisesha 8
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Close()
End Sub
End Class
Output:
VB.Net Programs
Prof. K. Adisesha 9
5. VB.Net Program to concatenate two strings and display result using
Message Box.
Code:
Public Class Form1
Private Sub resultBtn_Click(sender As Object, e As EventArgs) Handles resultBtn.Click
Dim x As String
Dim y As String
x = firstText.Text
y = lastText.Text
MsgBox(firstText.Text + " " + lastText.Text, vbOKCancel)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Close()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles btnclear.Click
firstText.Clear()
lastText.Clear()
End Sub
End Class
VB.Net Programs
Prof. K. Adisesha 10
Output:
VB.Net Programs
Prof. K. Adisesha 11
6. Write a program to change the style of font based on the user’s
choice by using CHECK BOX BUTTON
Public Class Form1
Private Sub setStyle()
Dim style = FontStyle.Regular
If boldCheck.Checked Then
style = style Or FontStyle.Bold
End If
If italicsCheck.Checked Then
style = style Or FontStyle.Italic
End If
If underLineCheck.Checked Then
style = style Or FontStyle.Underline
End If
inputText.Font = New Font(inputText.Font, style)
End Sub
Private Sub boldCheck_CheckedChanged(sender As Object, e As EventArgs) Handles
boldCheck.CheckedChanged
setStyle()
End Sub
Private Sub italicsCheck_CheckedChanged(sender As Object, e As EventArgs) Handles
italicsCheck.CheckedChanged
VB.Net Programs
Prof. K. Adisesha 12
setStyle()
End Sub
Private Sub underLineCheck_CheckedChanged(sender As Object, e As EventArgs)
Handles underLineCheck.CheckedChanged
setStyle()
End Sub
End Class
Output:
VB.Net Programs
Prof. K. Adisesha 13
7. Write a program to generate a Student Enrolment Details form using
Combo box.
Code:
Public Class Form1
Private Sub dispBtn_Click(sender As Object, e As EventArgs) Handles dispBtn.Click
MsgBox("These are the following details entered: " + vbCrLf + " Name:" + nameText.Text + vbCrLf
+ "Course:" + courseCombo.Text + vbCrLf + "Semester:" + semCombo.Text + vbCrLf + "Marks:" +
marksText.Text, vbOKOnly)
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Close()
End Sub
End Class
VB.Net Programs
Prof. K. Adisesha 14
Output:
VB.Net Programs
Prof. K. Adisesha 15
8. Write a program to generate a Dynamic User login form using
Database.
Code:
Note: Follow the following steps:
➢ Provide MySQL password
➢ Create a Database and provide DB name in Inputbox.
➢ Login table will be created with the given Name in Inputbox
Imports System.Data.Odbc
Public Class Form1
Dim uname As String = InputBox("Enter the UserName of MySql:")
Dim pass As String = InputBox("Enter the password of MySql:")
Dim dB As String = InputBox("Enter the DataBase name")
Dim connectionString As String = "DRIVER={MySQL ODBC 8.0 Unicode
Driver};SERVER=localhost;DATABASE=" + dB + ";UID=" + uname + ";PASSWORD=" + pass
+ ";OPTION=3;"
Public conn As New OdbcConnection(connectionString)
Dim sqlTableCreate As String = "CREATE TABLE users(username varchar(25),password
varchar(25));"
Dim cmdCreate As New OdbcCommand(sqlTableCreate, conn)
VB.Net Programs
Prof. K. Adisesha 16
Sub Open()
cmdCreate.ExecuteNonQuery()
End Sub
Private Sub createBtn_Click(sender As Object, e As EventArgs) Handles createBtn.Click
Try
If unameText.Text = "" Or passText.Text = "" Then
MsgBox("Please Provide the values", vbExclamation)
Else
conn.Open()
Dim rows As Integer
Dim sqlInsert As String = "INSERT INTO users(username,password) values(" + "'"
+ unameText.Text + "','" + passText.Text + "')"
Dim cmd As New OdbcCommand(sqlInsert, conn)
rows = cmd.ExecuteNonQuery()
If rows > 0 Then
MsgBox("User Created!", vbOK)
End If
End If
conn.Close()
Catch ex As Exception
MsgBox("Database Error", vbExclamation)
End Try
End Sub
Private Sub loginBtn_Click(sender As Object, e As EventArgs) Handles loginBtn.Click
Try
conn.Open()
Dim sqlSelect As String = "SELECT username,password FROM users WHERE
username=" + "'" + unameText.Text + "' AND " + "password='" + passText.Text + "'"
Dim cmd As New OdbcCommand(sqlSelect, conn)
Dim sqlResult As OdbcDataReader
sqlResult = cmd.ExecuteReader()
If sqlResult.HasRows Then
MsgBox("User Successfully Logged In", vbOK)
conn.Close()
Else
MsgBox("No Match found", vbExclamation)
conn.Close()
End If
Catch ex As Exception
MsgBox("DataBase Error", vbCritical)
End Try
VB.Net Programs
Prof. K. Adisesha 17
End Sub
Private Sub clearBtn_Click(sender As Object, e As EventArgs) Handles clearBtn.Click
unameText.Clear()
passText.Clear()
End Sub
Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles
showPassCheck.CheckedChanged
If showPassCheck.CheckState = CheckState.Unchecked Then
passText.PasswordChar = "*"
ElseIf showPassCheck.CheckState = CheckState.Checked Then
passText.PasswordChar = ""
End If
End Sub
End Class
Output:
VB.Net Programs
Prof. K. Adisesha 18
9. Program to Implement MDI (Multiple Document Interface) Parent Form
Follow the following Steps
➢ To make a form as MDI Form set its IsMdiContainer property as true.
➢ To define a parent form to a child form set MdiParent property.
➢ To arrange the child forms, use LayoutMdi() method.
➢ To get reference of the current child form use ActiveMdiChild property.
➢ To get reference of a control from the child form use its Controls collection.
Output:
VB.Net Programs
Prof. K. Adisesha 19

Mais conteúdo relacionado

Mais procurados

Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in androidPrawesh Shrestha
 
visual basic v6 introduction
visual basic v6 introductionvisual basic v6 introduction
visual basic v6 introductionbloodyedge03
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#Doncho Minkov
 
VB.NET:An introduction to Namespaces in .NET framework
VB.NET:An introduction to  Namespaces in .NET frameworkVB.NET:An introduction to  Namespaces in .NET framework
VB.NET:An introduction to Namespaces in .NET frameworkRicha Handa
 
vb.net Constructor and destructor
vb.net Constructor and destructorvb.net Constructor and destructor
vb.net Constructor and destructorsuraj pandey
 
User controls
User controlsUser controls
User controlsaspnet123
 
Modules and packages in python
Modules and packages in pythonModules and packages in python
Modules and packages in pythonTMARAGATHAM
 
Properties and indexers in C#
Properties and indexers in C#Properties and indexers in C#
Properties and indexers in C#Hemant Chetwani
 
Programming Paradigms
Programming ParadigmsProgramming Paradigms
Programming ParadigmsDirecti Group
 
introduction to visual basic PPT.pptx
introduction to visual basic PPT.pptxintroduction to visual basic PPT.pptx
introduction to visual basic PPT.pptxclassall
 
Android activity lifecycle
Android activity lifecycleAndroid activity lifecycle
Android activity lifecycleSoham Patel
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++rprajat007
 
Android life cycle
Android life cycleAndroid life cycle
Android life cycle瑋琮 林
 

Mais procurados (20)

Python programming : Control statements
Python programming : Control statementsPython programming : Control statements
Python programming : Control statements
 
android menus
android menusandroid menus
android menus
 
Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in android
 
visual basic v6 introduction
visual basic v6 introductionvisual basic v6 introduction
visual basic v6 introduction
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#
 
VB.NET:An introduction to Namespaces in .NET framework
VB.NET:An introduction to  Namespaces in .NET frameworkVB.NET:An introduction to  Namespaces in .NET framework
VB.NET:An introduction to Namespaces in .NET framework
 
Java input
Java inputJava input
Java input
 
vb.net Constructor and destructor
vb.net Constructor and destructorvb.net Constructor and destructor
vb.net Constructor and destructor
 
User controls
User controlsUser controls
User controls
 
Modules and packages in python
Modules and packages in pythonModules and packages in python
Modules and packages in python
 
Properties and indexers in C#
Properties and indexers in C#Properties and indexers in C#
Properties and indexers in C#
 
Meaning Of VB
Meaning Of VBMeaning Of VB
Meaning Of VB
 
Programming Paradigms
Programming ParadigmsProgramming Paradigms
Programming Paradigms
 
introduction to visual basic PPT.pptx
introduction to visual basic PPT.pptxintroduction to visual basic PPT.pptx
introduction to visual basic PPT.pptx
 
Android activity lifecycle
Android activity lifecycleAndroid activity lifecycle
Android activity lifecycle
 
Visual Basic 6.0
Visual Basic 6.0Visual Basic 6.0
Visual Basic 6.0
 
Android ui menu
Android ui menuAndroid ui menu
Android ui menu
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++
 
Android life cycle
Android life cycleAndroid life cycle
Android life cycle
 
4.C#
4.C#4.C#
4.C#
 

Semelhante a VB net lab.pdf

VISUAL BASIC PRATICAL FILE MSC COMPUTER SCIENCE.pdf
VISUAL BASIC PRATICAL FILE MSC COMPUTER SCIENCE.pdfVISUAL BASIC PRATICAL FILE MSC COMPUTER SCIENCE.pdf
VISUAL BASIC PRATICAL FILE MSC COMPUTER SCIENCE.pdfBALWANSAINI1
 
Inventory management
Inventory managementInventory management
Inventory managementRajeev Sharan
 
LoginFormCode
LoginFormCodeLoginFormCode
LoginFormCoderk5media
 
Membuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhanaMembuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhanaYusman Kurniadi
 
Ensayo Convergencia Informatica
Ensayo Convergencia InformaticaEnsayo Convergencia Informatica
Ensayo Convergencia Informaticamiguel camelo
 
Puerto serialarduino
Puerto serialarduinoPuerto serialarduino
Puerto serialarduinozadkiel_123
 
4.7.14&amp;17.7.14&amp;23.6.15&amp;10.9.15
4.7.14&amp;17.7.14&amp;23.6.15&amp;10.9.154.7.14&amp;17.7.14&amp;23.6.15&amp;10.9.15
4.7.14&amp;17.7.14&amp;23.6.15&amp;10.9.15Rajes Wari
 
I can't get my code below to work with Option Strict On due to this part of t...
I can't get my code below to work with Option Strict On due to this part of t...I can't get my code below to work with Option Strict On due to this part of t...
I can't get my code below to work with Option Strict On due to this part of t...hwbloom115
 
Lecture 09 high level language
Lecture 09 high level languageLecture 09 high level language
Lecture 09 high level language鍾誠 陳鍾誠
 
SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)Darwin Durand
 
Updated Visual Basic 6 for beginners.pptx
Updated Visual Basic 6 for beginners.pptxUpdated Visual Basic 6 for beginners.pptx
Updated Visual Basic 6 for beginners.pptxSarveshDeodhar
 
1. Determine the output displayed when the button is clicked.Priva.docx
1. Determine the output displayed when the button is clicked.Priva.docx1. Determine the output displayed when the button is clicked.Priva.docx
1. Determine the output displayed when the button is clicked.Priva.docxcorbing9ttj
 
1. Determine the output displayed when the button is clicked. Priv.docx
1. Determine the output displayed when the button is clicked. Priv.docx1. Determine the output displayed when the button is clicked. Priv.docx
1. Determine the output displayed when the button is clicked. Priv.docxcorbing9ttj
 
Kajal Gaharwal , BCA Third Year
Kajal Gaharwal , BCA Third YearKajal Gaharwal , BCA Third Year
Kajal Gaharwal , BCA Third YearDezyneecole
 
.Net Enterprise Services and their Implementations
.Net Enterprise Services and their Implementations.Net Enterprise Services and their Implementations
.Net Enterprise Services and their ImplementationsKashif Aleem
 

Semelhante a VB net lab.pdf (20)

Docimp
DocimpDocimp
Docimp
 
VISUAL BASIC PRATICAL FILE MSC COMPUTER SCIENCE.pdf
VISUAL BASIC PRATICAL FILE MSC COMPUTER SCIENCE.pdfVISUAL BASIC PRATICAL FILE MSC COMPUTER SCIENCE.pdf
VISUAL BASIC PRATICAL FILE MSC COMPUTER SCIENCE.pdf
 
Inventory management
Inventory managementInventory management
Inventory management
 
LoginFormCode
LoginFormCodeLoginFormCode
LoginFormCode
 
Membuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhanaMembuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhana
 
Ensayo Convergencia Informatica
Ensayo Convergencia InformaticaEnsayo Convergencia Informatica
Ensayo Convergencia Informatica
 
.net progrmming part4
.net progrmming part4.net progrmming part4
.net progrmming part4
 
Puerto serialarduino
Puerto serialarduinoPuerto serialarduino
Puerto serialarduino
 
Hems
HemsHems
Hems
 
4.7.14&amp;17.7.14&amp;23.6.15&amp;10.9.15
4.7.14&amp;17.7.14&amp;23.6.15&amp;10.9.154.7.14&amp;17.7.14&amp;23.6.15&amp;10.9.15
4.7.14&amp;17.7.14&amp;23.6.15&amp;10.9.15
 
UtilityCostCalcCode
UtilityCostCalcCodeUtilityCostCalcCode
UtilityCostCalcCode
 
I can't get my code below to work with Option Strict On due to this part of t...
I can't get my code below to work with Option Strict On due to this part of t...I can't get my code below to work with Option Strict On due to this part of t...
I can't get my code below to work with Option Strict On due to this part of t...
 
Lecture 09 high level language
Lecture 09 high level languageLecture 09 high level language
Lecture 09 high level language
 
SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)
 
Ete programs
Ete programsEte programs
Ete programs
 
Updated Visual Basic 6 for beginners.pptx
Updated Visual Basic 6 for beginners.pptxUpdated Visual Basic 6 for beginners.pptx
Updated Visual Basic 6 for beginners.pptx
 
1. Determine the output displayed when the button is clicked.Priva.docx
1. Determine the output displayed when the button is clicked.Priva.docx1. Determine the output displayed when the button is clicked.Priva.docx
1. Determine the output displayed when the button is clicked.Priva.docx
 
1. Determine the output displayed when the button is clicked. Priv.docx
1. Determine the output displayed when the button is clicked. Priv.docx1. Determine the output displayed when the button is clicked. Priv.docx
1. Determine the output displayed when the button is clicked. Priv.docx
 
Kajal Gaharwal , BCA Third Year
Kajal Gaharwal , BCA Third YearKajal Gaharwal , BCA Third Year
Kajal Gaharwal , BCA Third Year
 
.Net Enterprise Services and their Implementations
.Net Enterprise Services and their Implementations.Net Enterprise Services and their Implementations
.Net Enterprise Services and their Implementations
 

Mais de Prof. Dr. K. Adisesha

Software Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdfSoftware Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdfProf. Dr. K. Adisesha
 
Software Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdfSoftware Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdfProf. Dr. K. Adisesha
 
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdfSoftware Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdfProf. Dr. K. Adisesha
 
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdfSoftware Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdfProf. Dr. K. Adisesha
 
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdfSoftware Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdfProf. Dr. K. Adisesha
 
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdfSoftware Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdfProf. Dr. K. Adisesha
 
Computer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. AdiseshaComputer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. AdiseshaProf. Dr. K. Adisesha
 
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. AdiaeshaCCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. AdiaeshaProf. Dr. K. Adisesha
 
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. AdiseshaCCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. AdiseshaProf. Dr. K. Adisesha
 
CCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. AdiseshaCCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. AdiseshaProf. Dr. K. Adisesha
 
CCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdfCCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdfProf. Dr. K. Adisesha
 

Mais de Prof. Dr. K. Adisesha (20)

Software Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdfSoftware Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdf
 
Software Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdfSoftware Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdf
 
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdfSoftware Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
 
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdfSoftware Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
 
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdfSoftware Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
 
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdfSoftware Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
 
Computer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. AdiseshaComputer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. Adisesha
 
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. AdiaeshaCCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
 
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. AdiseshaCCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
 
CCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. AdiseshaCCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. Adisesha
 
CCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdfCCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdf
 
Introduction to Computers.pdf
Introduction to Computers.pdfIntroduction to Computers.pdf
Introduction to Computers.pdf
 
R_Programming.pdf
R_Programming.pdfR_Programming.pdf
R_Programming.pdf
 
Scholarship.pdf
Scholarship.pdfScholarship.pdf
Scholarship.pdf
 
Operating System-2 by Adi.pdf
Operating System-2 by Adi.pdfOperating System-2 by Adi.pdf
Operating System-2 by Adi.pdf
 
Operating System-1 by Adi.pdf
Operating System-1 by Adi.pdfOperating System-1 by Adi.pdf
Operating System-1 by Adi.pdf
 
Operating System-adi.pdf
Operating System-adi.pdfOperating System-adi.pdf
Operating System-adi.pdf
 
Data_structure using C-Adi.pdf
Data_structure using C-Adi.pdfData_structure using C-Adi.pdf
Data_structure using C-Adi.pdf
 
JAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdfJAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdf
 
JAVA PPT -5 BY ADI.pdf
JAVA PPT -5 BY ADI.pdfJAVA PPT -5 BY ADI.pdf
JAVA PPT -5 BY ADI.pdf
 

Último

Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 

Último (20)

Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 

VB net lab.pdf

  • 1. VB.Net Programs Prof. K. Adisesha 1 C# & Dot Net Lab Programs Part- B 1. VB.net Program to count the number of Vowels in a string Public Class Form1 Private Sub resultBtn_Click(sender As Object, e As EventArgs) Handles resultBtn.Click Dim str1, str2 As String Dim vcount, i, str1len As Integer vcount = 0 str1 = stringText.Text str1len = Len(str1) str1 = LCase(str1) For i = 1 To str1len str2 = Mid(str1, i, 1) If str2 = "a" Or str2 = "e" Or str2 = "i" Or str2 = "o" Or str2 = "u" Then vcount = vcount + 1 End If Next i resultText.Text = vcount End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Close() End Sub End Class
  • 2. VB.Net Programs Prof. K. Adisesha 2 Output:
  • 3. VB.Net Programs Prof. K. Adisesha 3 2. VB.net Program to Check a given is Even or Odd Number or Overflow if number>10000 Code: Public Class Form1 Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles resultBtn.Click If valueText.Text Mod 2 = 0 Then resultText.Text = "EVEN" Else resultText.Text = "ODD" End If If valueText.Text > 10000 Then resultText.Text = "Overflow!!!" End If
  • 4. VB.Net Programs Prof. K. Adisesha 4 End Sub Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click valueText.Text = "" End Sub Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click Close() End Sub End Class Output:
  • 5. VB.Net Programs Prof. K. Adisesha 5 3. VB.net Program to calculate the compound interest Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles resultBtn.Click Dim P As Integer Dim R As Integer Dim n As Integer P = principleText.Text R = rateText.Text n = timeText.Text compText.Text = P * (1 + (R / 100)) ^ n - 1 End Sub Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles btnExit.Click Close() End Sub
  • 6. VB.Net Programs Prof. K. Adisesha 6 Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click principleText.Text = "" rateText.Text = "" timeText.Text = "" End Sub End Class Output:
  • 7. VB.Net Programs Prof. K. Adisesha 7 4. VB.Net Program to Display the sum of Positive and negative numbers using input box Code: Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub Private Sub resultBtn_Click(sender As Object, e As EventArgs) Handles resultBtn.Click Dim arr(), a, b, c, i As Integer a = CInt(limitText.Text) ReDim arr(a) For i = 0 To a - 1 Step 1 arr(i) = CInt(InputBox("Enter elements:")) If arr(i) > 0 Then b = b + arr(i) ElseIf arr(i) < 0 Then c = c + arr(i) End If Next positiveText.Text = b negativeText.Text = c End Sub
  • 8. VB.Net Programs Prof. K. Adisesha 8 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Close() End Sub End Class Output:
  • 9. VB.Net Programs Prof. K. Adisesha 9 5. VB.Net Program to concatenate two strings and display result using Message Box. Code: Public Class Form1 Private Sub resultBtn_Click(sender As Object, e As EventArgs) Handles resultBtn.Click Dim x As String Dim y As String x = firstText.Text y = lastText.Text MsgBox(firstText.Text + " " + lastText.Text, vbOKCancel) End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnExit.Click Close() End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles btnclear.Click firstText.Clear() lastText.Clear() End Sub End Class
  • 10. VB.Net Programs Prof. K. Adisesha 10 Output:
  • 11. VB.Net Programs Prof. K. Adisesha 11 6. Write a program to change the style of font based on the user’s choice by using CHECK BOX BUTTON Public Class Form1 Private Sub setStyle() Dim style = FontStyle.Regular If boldCheck.Checked Then style = style Or FontStyle.Bold End If If italicsCheck.Checked Then style = style Or FontStyle.Italic End If If underLineCheck.Checked Then style = style Or FontStyle.Underline End If inputText.Font = New Font(inputText.Font, style) End Sub Private Sub boldCheck_CheckedChanged(sender As Object, e As EventArgs) Handles boldCheck.CheckedChanged setStyle() End Sub Private Sub italicsCheck_CheckedChanged(sender As Object, e As EventArgs) Handles italicsCheck.CheckedChanged
  • 12. VB.Net Programs Prof. K. Adisesha 12 setStyle() End Sub Private Sub underLineCheck_CheckedChanged(sender As Object, e As EventArgs) Handles underLineCheck.CheckedChanged setStyle() End Sub End Class Output:
  • 13. VB.Net Programs Prof. K. Adisesha 13 7. Write a program to generate a Student Enrolment Details form using Combo box. Code: Public Class Form1 Private Sub dispBtn_Click(sender As Object, e As EventArgs) Handles dispBtn.Click MsgBox("These are the following details entered: " + vbCrLf + " Name:" + nameText.Text + vbCrLf + "Course:" + courseCombo.Text + vbCrLf + "Semester:" + semCombo.Text + vbCrLf + "Marks:" + marksText.Text, vbOKOnly) End Sub Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click Close() End Sub End Class
  • 14. VB.Net Programs Prof. K. Adisesha 14 Output:
  • 15. VB.Net Programs Prof. K. Adisesha 15 8. Write a program to generate a Dynamic User login form using Database. Code: Note: Follow the following steps: ➢ Provide MySQL password ➢ Create a Database and provide DB name in Inputbox. ➢ Login table will be created with the given Name in Inputbox Imports System.Data.Odbc Public Class Form1 Dim uname As String = InputBox("Enter the UserName of MySql:") Dim pass As String = InputBox("Enter the password of MySql:") Dim dB As String = InputBox("Enter the DataBase name") Dim connectionString As String = "DRIVER={MySQL ODBC 8.0 Unicode Driver};SERVER=localhost;DATABASE=" + dB + ";UID=" + uname + ";PASSWORD=" + pass + ";OPTION=3;" Public conn As New OdbcConnection(connectionString) Dim sqlTableCreate As String = "CREATE TABLE users(username varchar(25),password varchar(25));" Dim cmdCreate As New OdbcCommand(sqlTableCreate, conn)
  • 16. VB.Net Programs Prof. K. Adisesha 16 Sub Open() cmdCreate.ExecuteNonQuery() End Sub Private Sub createBtn_Click(sender As Object, e As EventArgs) Handles createBtn.Click Try If unameText.Text = "" Or passText.Text = "" Then MsgBox("Please Provide the values", vbExclamation) Else conn.Open() Dim rows As Integer Dim sqlInsert As String = "INSERT INTO users(username,password) values(" + "'" + unameText.Text + "','" + passText.Text + "')" Dim cmd As New OdbcCommand(sqlInsert, conn) rows = cmd.ExecuteNonQuery() If rows > 0 Then MsgBox("User Created!", vbOK) End If End If conn.Close() Catch ex As Exception MsgBox("Database Error", vbExclamation) End Try End Sub Private Sub loginBtn_Click(sender As Object, e As EventArgs) Handles loginBtn.Click Try conn.Open() Dim sqlSelect As String = "SELECT username,password FROM users WHERE username=" + "'" + unameText.Text + "' AND " + "password='" + passText.Text + "'" Dim cmd As New OdbcCommand(sqlSelect, conn) Dim sqlResult As OdbcDataReader sqlResult = cmd.ExecuteReader() If sqlResult.HasRows Then MsgBox("User Successfully Logged In", vbOK) conn.Close() Else MsgBox("No Match found", vbExclamation) conn.Close() End If Catch ex As Exception MsgBox("DataBase Error", vbCritical) End Try
  • 17. VB.Net Programs Prof. K. Adisesha 17 End Sub Private Sub clearBtn_Click(sender As Object, e As EventArgs) Handles clearBtn.Click unameText.Clear() passText.Clear() End Sub Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles showPassCheck.CheckedChanged If showPassCheck.CheckState = CheckState.Unchecked Then passText.PasswordChar = "*" ElseIf showPassCheck.CheckState = CheckState.Checked Then passText.PasswordChar = "" End If End Sub End Class Output:
  • 18. VB.Net Programs Prof. K. Adisesha 18 9. Program to Implement MDI (Multiple Document Interface) Parent Form Follow the following Steps ➢ To make a form as MDI Form set its IsMdiContainer property as true. ➢ To define a parent form to a child form set MdiParent property. ➢ To arrange the child forms, use LayoutMdi() method. ➢ To get reference of the current child form use ActiveMdiChild property. ➢ To get reference of a control from the child form use its Controls collection. Output: