Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 49

KARPAGAM ACADEMY OF HIGHER EDUCATION

(Deemed to be University)
(Established Under section 3 of UGC act 1956)
Accredited with A+ Grade by NAAC in the Second Cycle
Coimbatore-641021.

DEPARTMENT OF COMPUTER SCIENCE

.NET PROGRAMMING PRACTICAL

(22CSU414A)

II B.Sc COMPUTER SCIENCE (2022-2025)

NAME :

REG.NO :
KARPAGAM ACADEMY OF HIGHER EDUCATION
Coimbatore-21
DEPARTMENT OF COMPUTER
SCIENCE

BONAFIDE CERTIFICATE

REG NO:

This is to certify that this is a bonafide record work done by


……………………………. of II B.Sc (Computer Science) during the
academic year January 2024 – May 2024 and submitted for the practical
examination in .NET PROGRAMMING PRACTICAL (22CSU414A) held
on ___________.

Staff-in-charge Head of the Department

Internal Examiner External Examiner


INDEX

S.NO DATE TITLE PAGE NO SIGNATURE

FACTORIAL OF A NUMBER USING


1
FUNCTION

2 STRING MANIPULATION

3 MANIPULATE DATA

TEXT EDITOR USING RICH TEXTBOX


4

METHODS AND PROPERTIES OF


5
LISTBOX

METHODS AND PROPERTIES OF


6
LISTVIEW

7 MDI CONTROL

8 EMPLOYEE DATABASE

9 EMPLOYEE REGISTRATION

10 CANTEEN ORDER
EX.NO:01
FACTORIAL OF A NUMBER USING FUNCTION
DATE :
AIM:

To Develop a program to factorial of a number using function

Algorithm:

Step 1:Open Microsoft Visual Studio 2012 and create a new windows form application.

STEP 2: Click the start to new project click visual basic to windows form applications
then click ok.
Step 3:Add the Label, Button and a TextBox inside theForm.

Step 4:Double click the button and do the following code inside the sub procedure for
getting factorial numbers.

Step 5:run the code.


step 6:out put will disolay in the screen.

CODING:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load

 Dim n, f, i As Integer
 f=1
 n = Val(TextBox1.Text)
 For i = 1 To n
 f=f*i
 Next
 MsgBox(“Factorial is :” & f, vbInformation, “Factorial”)
End Sub
Form Design:

Output:

Result:
Thus the above program excuted successfully
EX.NO:02
STRING MANIPULATION
DATE :

AIM :
To write a VB.NET program to perform a string Handling Functions.

ALGORITHM :

STEP 1: Open a form and use necessary controls that are required for our applications.
STEP 2: Get two input strings from the user through the TextBox.
STEP 3: Perform the various string manipulation function.
STEP 4: Display the result.
STEP 5: Save and Run the application.
PROGRAM:

Public Class Form1


Dim str1 As String
Dim str2 As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
str1 = TextBox1.Text
str2 = TextBox2.Text
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
str1 = TextBox1.Text
str2 = TextBox2.Text
MsgBox(StrReverse(str1))
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
MsgBox(String.Concat(str1, str2))
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
str1 = TextBox1.Text
str2 = TextBox2.Text
If (String.Equals(str1, str2)) Then
MsgBox("Strings are equal")
Else
MsgBox("Strings are not equal")
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
str1 = TextBox1.Text
MsgBox(str1.Length())
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
str1 = TextBox1.Text
str2 = TextBox2.Text
MsgBox(TextBox1.Text.Substring(3))
MsgBox(TextBox1.Text.Substring(2))
End Sub
End Class
OUTPUT:

RESULT:
Various string manipulation has been performed.
EX.NO:03
DATE :

MANIPULATE DATA

AIM :
Develop a VB.NET program to create a form, place control and manipulate data.
ALGORITHM :

STEP 1: Open a form and use create controls that are required for form, two label, two
Textbox, Button application.
STEP 2: Get two input strings from the user through the TextBox.
STEP 3: The values using the equation Total=Val(Text1.Text)+Val(Text2.Text).
STEP 4: Display the result in the MsgBox.
STEP 5: Save and Run the application.
PROGRAM:
Public Class Form1
Dim form2 As New Form
Dim label1, label2 As Control
Dim txt1, txt2 As Control
Dim btnl As Control
Dim total As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
form2.Text = "Vn"
form2.Show()
form2.Size = New Size(500, 500)
Me.WindowState = FormWindowState.Minimized
End Sub
Private Sub btn1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
total = Val(txt1.Text) + Val(txt2.Text)
MsgBox(total)
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
label1 = New System.Windows.Forms.Label
label1.AutoSize = True
label1.Location = New System.Drawing.Point(90, 10)
label1.Size = New System.Drawing.Size(31, 51)
label1.TabIndex = 0
label1.Text = "Enter the mark 01 "
label1.ForeColor = Color.Black
label1.Font = New Drawing.Font("times new Roman", 14, FontStyle.Bold)
label1.Visible = True
form2.Controls.Add(label1)
label2 = New System.Windows.Forms.Label
label2.AutoSize = True
label2.Location = New System.Drawing.Point(90, 70)
label2.Size = New System.Drawing.Size(31, 51)
label2.TabIndex = 0
label2.Text = "Enter the mark 02"
label2.ForeColor = Color.Black
label2.Font = New Drawing.Font("Times new Roman", 14, FontStyle.Bold)
label2.Visible = True
form2.Controls.Add(label2)
txt1 = New System.Windows.Forms.TextBox
txt1.AutoSize = True
txt1.Location = New System.Drawing.Point(300, 10)
txt1.Size = New System.Drawing.Size(51, 71)
txt1.TabIndex = 0
txt1.ForeColor = Color.Black
txt1.Font = New Drawing.Font("times new Roman", 14, FontStyle.Bold)
txt1.Visible = True
form2.Controls.Add(txt1)
txt2 = New System.Windows.Forms.TextBox
txt2.AutoSize = True
txt2.Location = New System.Drawing.Point(300, 70)
txt2.Size = New System.Drawing.Size(51, 71)
txt2.TabIndex = 0
txt2.ForeColor = Color.Black
txt2.Font = New Drawing.Font("Times new Roman", 14, FontStyle.Bold)
txt2.Visible = True
form2.Controls.Add(txt2)
btnl = New System.Windows.Forms.Button
btnl.AutoSize = True
btnl.Location = New System.Drawing.Point(90, 130)
btnl.Size = New System.Drawing.Size(51, 71)
btnl.TabIndex = 0
btnl.Text = "Calculate"
btnl.ForeColor = Color.Blue
btnl.Font = New Drawing.Font("times new Roman", 14, FontStyle.Bold)
btnl.Visible = True
form2.Controls.Add(btnl)
AddHandler btnl.Click, AddressOf btn1_Click
End Sub
End Class
OUTPUT:

RESULT:

Data is manipulated in dynamic form.

EX.NO:04
Text Editor using Rich Textbox
DATE

Aim:
To Creating a simple text editor with undo, redo, cut, copy, paste, select all,
find, replace, load file, and save file operations using Visual Studio, VB.NET,
and RichTextBox involves several steps.
Algorithm:
1. Create a new VB.NET Windows Forms Application:
- Open Visual Studio.
- Create a new Windows Forms Application project.

2. **Design the Form:**


- Add a RichTextBox control to the form.
- Add a MenuStrip to the form.
- Add menu items for File (New, Open, Save, Save As, Exit), Edit (Undo,
Redo, Cut, Copy, Paste, Select All), and Search (Find, Replace).

3. **Code the Form:**


- Double-click on the menu items to generate event handlers.
- In the form code, declare variables for tracking file path, current text, etc.
- Implement File menu item handlers for New, Open, Save, Save As, and Exit
operations.
- Implement Edit menu item handlers for Undo, Redo, Cut, Copy, Paste, and
Select All operations.
- Implement Search menu item handlers for Find and Replace operations.
4. **Run the Application:**
- Build and run your application to test the text editor.

Coding:
Public Class Form1
Private filePath As String = ""
Private currentText As String = ""

' File Menu


Private Sub NewToolStripMenuItem_Click(sender As Object, e As
EventArgs) Handles NewToolStripMenuItem.Click
RichTextBox1.Clear()
filePath = ""
currentText = ""
End Sub

Private Sub OpenToolStripMenuItem_Click(sender As Object, e As


EventArgs) Handles OpenToolStripMenuItem.Click
Dim openFileDialog As New OpenFileDialog()
openFileDialog.Filter = "Text Files|*.txt|All Files|*.*"
If openFileDialog.ShowDialog() = DialogResult.OK Then
filePath = openFileDialog.FileName
currentText = System.IO.File.ReadAllText(filePath)
RichTextBox1.Text = currentText
End If
End Sub

Private Sub SaveToolStripMenuItem_Click(sender As Object, e As


EventArgs) Handles SaveToolStripMenuItem.Click
If filePath = "" Then
SaveAsToolStripMenuItem.PerformClick()
Else
System.IO.File.WriteAllText(filePath, RichTextBox1.Text)
currentText = RichTextBox1.Text
End If
End Sub

Private Sub SaveAsToolStripMenuItem_Click(sender As Object, e As


EventArgs) Handles SaveAsToolStripMenuItem.Click
Dim saveFileDialog As New SaveFileDialog()
saveFileDialog.Filter = "Text Files|*.txt|All Files|*.*"
If saveFileDialog.ShowDialog() = DialogResult.OK Then
filePath = saveFileDialog.FileName
System.IO.File.WriteAllText(filePath, RichTextBox1.Text)
currentText = RichTextBox1.Text
End If
End Sub

Private Sub ExitToolStripMenuItem_Click(sender As Object, e As


EventArgs) Handles ExitToolStripMenuItem.Click
Me.Close()
End Sub

' Edit Menu


Private Sub UndoToolStripMenuItem_Click(sender As Object, e As
EventArgs) Handles UndoToolStripMenuItem.Click
RichTextBox1.Undo()
End Sub

Private Sub RedoToolStripMenuItem_Click(sender As Object, e As


EventArgs) Handles RedoToolStripMenuItem.Click
RichTextBox1.Redo()
End Sub

Private Sub CutToolStripMenuItem_Click(sender As Object, e As


EventArgs) Handles CutToolStripMenuItem.Click
RichTextBox1.Cut()
End Sub

Private Sub CopyToolStripMenuItem_Click(sender As Object, e As


EventArgs) Handles CopyToolStripMenuItem.Click
RichTextBox1.Copy()
End Sub

Private Sub PasteToolStripMenuItem_Click(sender As Object, e As


EventArgs) Handles PasteToolStripMenuItem.Click
RichTextBox1.Paste()
End Sub

Private Sub SelectAllToolStripMenuItem_Click(sender As Object, e As


EventArgs) Handles SelectAllToolStripMenuItem.Click
RichTextBox1.SelectAll()
End Sub
' Search Menu
Private Sub FindToolStripMenuItem_Click(sender As Object, e As
EventArgs) Handles FindToolStripMenuItem.Click
' Implement Find functionality
End Sub
Private Sub ReplaceToolStripMenuItem_Click(sender As Object, e As
EventArgs) Handles ReplaceToolStripMenuItem.Click
' Implement Replace functionality
End Sub
End Class
OUTPUT
Result:
Thus the above program was executed successfully.
EX.NO:05
Methods and Properties of Listbox
DATE

Aim
To demonstrate use of methods and properties of listbox

Algorithm:

1. Open Visual Studio or any other VB development environment you are


using.

2. Start a new Windows Forms Application project.

3. Drag and drop a `ListBox` control and three buttons (`btnAdd`,


`btnRemove`, `btnClear`) onto the form.

Public Class Form1

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles


MyBase.Load
' Set properties for ListBox
ListBox1.Location = New Point(10, 10)
ListBox1.Size = New Size(200, 150)

' Set properties for btnAdd


btnAdd.Text = "Add Item"
btnAdd.Location = New Point(220, 10)

' Set properties for btnRemove


btnRemove.Text = "Remove Item"
btnRemove.Location = New Point(220, 50)

' Set properties for btnClear


btnClear.Text = "Clear All"
btnClear.Location = New Point(220, 90)

' Add controls to the form


Me.Controls.Add(ListBox1)
Me.Controls.Add(btnAdd)
Me.Controls.Add(btnRemove)
Me.Controls.Add(btnClear)
End Sub

' Event handler for btnAdd


Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles
btnAdd.Click
Dim newItem As String = InputBox("Enter a new item:", "Add Item")
If Not String.IsNullOrEmpty(newItem) Then
ListBox1.Items.Add(newItem)
End If
End Sub

' Event handler for btnRemove


Private Sub btnRemove_Click(sender As Object, e As EventArgs) Handles
btnRemove.Click
If ListBox1.SelectedIndex <> -1 Then
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
End If
End Sub

' Event handler for btnClear


Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles
btnClear.Click
ListBox1.Items.Clear()
End Sub
End Class
OUTPUT
EX.NO:06
Methods and Properties of Listview
DATE

Aim
To demonstrate use of methods and properties of listView

Algorithm:
1. Open Visual Studio or any other VB development environment.

2. Start a new Windows Forms Application project.

3. Drag and drop a `ListView` control and three buttons (`btnAdd`,


`btnRemove`, `btnClear`) onto the form.

Public Class Form1


Private WithEvents ListView1 As New ListView()
Private WithEvents btnAdd As New Button()
Private WithEvents btnRemove As New Button()
Private WithEvents btnClear As New Button()

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles


MyBase.Load
' Set properties for ListView
ListView1.Location = New Point(10, 10)
ListView1.Size = New Size(200, 150)
ListView1.View = View.Details
ListView1.Columns.Add("Items", 150)

' Set properties for btnAdd


btnAdd.Text = "Add Item"
btnAdd.Location = New Point(220, 10)

' Set properties for btnRemove


btnRemove.Text = "Remove Item"
btnRemove.Location = New Point(220, 50)

' Set properties for btnClear


btnClear.Text = "Clear All"
btnClear.Location = New Point(220, 90)

' Add controls to the form


Me.Controls.Add(ListView1)
Me.Controls.Add(btnAdd)
Me.Controls.Add(btnRemove)
Me.Controls.Add(btnClear)
End Sub

' Event handler for btnAdd


Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles
btnAdd.Click
Dim newItem As String = InputBox("Enter a new item:", "Add Item")
If Not String.IsNullOrEmpty(newItem) Then
Dim item As New ListViewItem(newItem)
ListView1.Items.Add(item)
End If
End Sub

' Event handler for btnRemove


Private Sub btnRemove_Click(sender As Object, e As EventArgs) Handles
btnRemove.Click
If ListView1.SelectedItems.Count > 0 Then
ListView1.Items.Remove(ListView1.SelectedItems(0))
End If
End Sub

' Event handler for btnClear


Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles
btnClear.Click
ListView1.Items.Clear()
End Sub
End Class
OUTPUT
Result:

Hence the program is executed successfully.


EX.NO:03
DATE :
MDI CONTROL

AIM:
To create MDI application having file menu (New, Open, Save, Print, Close) and Format
menu (Font, Forecolor, Backcolor).

ALGORITHM:

1.Open Visual Studio and create a new Windows Forms Application.

2. - Add a `MenuStrip` control to the form.


- Add a `ToolStripMenuItem` for each menu item (`New`, `Open`, `Save`, `Print`, `Close`, `Font`,
`ForeColor`, `BackColor`).
- Set the `Name` property for each menu item (e.g., `mnuNew`, `mnuOpen`,etc.).
- Handle the click events for each menu item to implement their functionality.

3. - Create a new Windows Form (`ChildForm`) to be used as an MDI child form.


- Customize the form as needed for your application.

4. - For simplicity, let’s create a basic screen saver using a timer.


- Add a `Timer` control to the MDI Parent Form.
- Handle the `Tick` event of the timer to update the screen saver.

Public Class Form1

Private Sub NewToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles


NewToolStripMenuItem.Click
TextBox1.Text = ""

End Sub

Private Sub OpenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles


OpenToolStripMenuItem.Click
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
TextBox1.Text =
My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName)

End If
End Sub

Private Sub SaveToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles


SaveToolStripMenuItem.Click
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
My.Computer.FileSystem.WriteAllText(SaveFileDialog1.FileName,
TextBox1.Text, False)

End If
End Sub

Private Sub PrintToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles


PrintToolStripMenuItem.Click
PrintDialog1.ShowDialog()

End Sub

Private Sub CloseToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles


CloseToolStripMenuItem.Click
End

End Sub

Private Sub FontToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles


FontToolStripMenuItem.Click
If FontDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
TextBox1.Font = FontDialog1.Font

End If
End Sub

Private Sub ForecoloreToolStripMenuItem_Click(sender As Object, e As EventArgs)


Handles ForecoloreToolStripMenuItem.Click
If ColorDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
TextBox1.ForeColor = ColorDialog1.Color

End If
End Sub
End Class
OUTPUT
EX.NO:08
DATE:
EMPLOYEE DETAILS

AIM:
To write a VB.NET program for retrieving the employee details with the help of SQL
server.
ALGORITHM:

STEP1: Create an Employee details using SQL server.


STEP2: Activate the SQL connection.
STEP3: Select Data Connection and Right Click then click create New SQL server database.
STEP4: Pick the server name from the dropdown box and give new database name.
STEP5: Goto new instance of Data Connection ->Name.
STEP6: Goto Main Menu , Select data click add new Data Source->Click Database->Next->
New Connection->Give Server Name->Database name, filename->choose right to
Tables->Add new table->Create field names .
PROGRAM:
Imports System.Data.SqlClient.SqlDataReader
Imports System.Data.SqlClient
Imports System.Data
Public Class Form1
Dim con As New SqlConnection
Dim cmd As New SqlCommand
Dim ar As SqlDataAdapter
Dim ds As DataSet
Dim dr As SqlDataReader
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
'TODO: This line of code loads data into the 'EmployeeDataSet1.emp' table. You can move,
or remove it, as needed.
Me.EmpTableAdapter.Fill(Me.EmployeeDataSet1.emp)
con = New SqlConnection("Data Source=SYSTEM156\SQLEXPRESS;Initial
Catalog=employee;Integrated Security=True")
con.Open()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
cmd = New SqlCommand("insert into emp values('" & TextBox1.Text & "'," &
TextBox2.Text & ",'" & TextBox3.Text & "'," & TextBox4.Text & "," & TextBox5.Text &
"," & TextBox6.Text & "," & TextBox7.Text & "," & TextBox8.Text & ")", con)
cmd.ExecuteNonQuery()
'DataGridView1.Focus()
'DataGridView1.RefreshEdit()
DataGridView1.Visible = "True"
MsgBox("INSERTED")
cmd.Dispose()
con.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
Dim a As Integer
a = InputBox("Enter the Enum")
cmd = New SqlCommand("Update emp set designation='programmer' where enum =" &
Val(a) & "", con)
cmd.ExecuteNonQuery()
MsgBox("UPDATED")
DataGridView1.Visible = "True"
cmd.Dispose()
con.Close()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
Dim a As Integer
a = InputBox("enter the enum")
cmd = New SqlCommand("Delete From emp where enum=" & Val(a) & "", con)
DataGridView1.Visible = False
cmd.ExecuteNonQuery()
MsgBox("DELETED")
DataGridView1.Visible = "True"
cmd.Dispose()
con.Close()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button4.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
End Sub
Private Sub TextBox8_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs)
Handles TextBox8.GotFocus
'TextBox5.Text = Val(TextBox4.Text) * 0.3
'TextBox6.Text = Val(TextBox4.Text) * 0.2
'TextBox7.Text = Val(TextBox4.Text) * 0.1
TextBox8.Text = Val(TextBox4.Text) + Val(TextBox5.Text) + Val(TextBox6.Text)
End Sub
Private Sub TextBox5_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs)
Handles TextBox5.GotFocus
TextBox5.Text = Val(TextBox4.Text) * 0.3
End Sub
Private Sub TextBox6_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs)
Handles TextBox6.GotFocus
TextBox6.Text = Val(TextBox4.Text) * 0.2
End Sub
Private Sub TextBox7_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs)
Handles TextBox7.GotFocus
TextBox7.Text = Val(TextBox4.Text) * 0.1
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles
DataGridView1.CellContentClick
End Sub
Private Sub DataGridView1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles DataGridView1.Click
DataGridView1.DataSource = EmployeeDataSet1.emp
End Sub
End Class
OUTPUT:

RESULT:

Thus the manipulation of the data has been carried over.


EX.NO:09
Employee Registration
DATE :

AIM:
To Create employee registration form to collect details (using radio button, checkbox and other
controls).

ALGORITHM:

Step 1: Create a New VB.NET Windows Forms Application

1. Open Visual Studio.

2. Create a new Windows Forms Application project.

Step 2: Design the Form

1. Drag and drop the following controls onto the form:

- TextBox controls for `FirstName`, `LastName`, `Email`, and `Phone`.

- RadioButton controls for `Male` and `Female`.

- CheckBox controls for `Programming`, `Designing`, and `Testing`.

- ComboBox for `Department`.

- DateTimePicker for `DateOfBirth`.

- Button to submit the form.

2. Arrange the controls on the form as needed.

Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Form2.Show()
Form2.Label1.Text = TextBox1.Text
Form2.Label2.Text = TextBox2.Text
Form2.Label3.Text = TextBox3.Text
Form2.Label4.Text = ComboBox1.Text
If CheckBox1.Checked - True Then
Form2.Label5.Text = CheckBox1.Text
End If
If CheckBox2.Checked - True Then
Form2.Label6.Text = CheckBox2.Text
End If
If CheckBox3.Checked - True Then
Form2.Label7.Text = CheckBox3.Text
End If
If RadioButton1.Checked = True Then
Form2.Label8.Text = RadioButton1.Text
End If
If RadioButton2.Checked = True Then
Form2.Label8.Text = RadioButton2.Text
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


End

End Sub
End Class
OUTPUT

RESULT:

Hence Employee registration is done


EX.NO:10
CANTEEN ORDER
DATE :

Aim:

creating a simple Canteen Order Form in VB.NET. This form will use a ListBox to display selected
items and a ComboBox to list available food items.

Algorithm:

Step 1: Create a New VB.NET Windows Forms Application

1. Open Visual Studio.


2. Create a new Windows Forms Application project.
3: Design the Form
4. Drag and drop the following controls onto the form:
- ComboBox for listing food items (`cmbFoodItems`).
- TextBox for entering quantity (`txtQuantity`).
- Button to add the selected item to the order (`btnAddToOrder`).
- ListBox to display the selected items (`lstOrder`).
- Button to place the order (`btnPlaceOrder`).

5. Arrange the controls on the form as needed.

Public Class Form1

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load


ComboBox1.Items.Clear()
ComboBox1.Items.Add("Coffee")
ComboBox1.Items.Add("Tea")
ComboBox1.Items.Add("Juice")
ComboBox1.Items.Add("Ice Cream")
ComboBox1.Items.Add("Idily")
ComboBox1.Items.Add("Puri")
ComboBox1.Items.Add("Vada")
ComboBox1.Items.Add("Pongal")
ComboBox1.Items.Add("Dosai")
ComboBox1.Items.Add("Ghee Roast")
ComboBox1.Items.Add("Masala Roast")
ComboBox1.Items.Add("Podi Roast")

ComboBox2.Items.Add("1")
ComboBox2.Items.Add("2")
ComboBox2.Items.Add("3")
ComboBox2.Items.Add("4")
ComboBox2.Items.Add("5")
ComboBox2.Items.Add("6")
ComboBox2.Items.Add("7")
ComboBox2.Items.Add("8")
ComboBox2.Items.Add("9")
ComboBox2.Items.Add("10")
ComboBox2.Items.Add("11")
ComboBox2.Items.Add("12")
ComboBox1.Text = "select from...."
ComboBox2.Text = "select from...."

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Label5.Text = ComboBox2.SelectedItem * TextBox1.Text

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


ComboBox1.Text = ""
ComboBox2.Text = ""
TextBox1.Text = ""
Label5.Text = ""

End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


Me.Close()

End Sub
End Class
OUTPUT

Result :

Hence the Program is executed Successfully.

You might also like