Record (Rectified Version)
Record (Rectified Version)
Coding:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs)
Handles Button1.Click
ComboBox1.Items.Add(TextBox1.Text)
TextBox1.Clear()
End Sub
Design Window:
Output
Program 2: tree view control (output ok)
Coding:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs)
Handles Button1.Click
Dim node As String
node = InputBox("Enter Node name ") ' Corrected variable
usage
Design Window:
PROGRAM 3: EXCEPTION (output ok)
Coding:
Imports System
Class CustomException
Inherits ApplicationException
Public Sub New(Message As String)
MyBase.New(Message)
End Sub
End Class
Coding:
Imports System.Reflection
' Constructor
Public Sub New(name As String, age As Integer, department As
String, position As String, salary As Integer)
Me.Name = name
Me.Age = age
Me.Department = department
Me.Position = position
Me.Salary = salary
End Sub
End Class
Design Window:
Output:
Program 5: click, mouse down, key down, form load(output ok)
Coding:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs)
Handles MyBase.Load
MessageBox.Show("Form Loaded")
End Sub
Private Sub Form1_Click(sender As Object, e As EventArgs)
Handles MyBase.Click
MessageBox.Show("Form Clicked")
End Sub
Output:
Program 6 : file menu with menu items (output ok)
Coding:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs)
Handles MyBase.Load
InitializeMenus()
End Sub
Private Sub InitializeMenus()
' File Menu
Dim fileMenu As ToolStripMenuItem = CreateMenuItem("File")
fileMenu.DropDownItems.Add(CreateMenuItem("New",
AddressOf NewFile_Click))
fileMenu.DropDownItems.Add(CreateMenuItem("Open",
AddressOf OpenFile_Click))
fileMenu.DropDownItems.Add(CreateMenuItem("Save",
AddressOf SaveFile_Click))
fileMenu.DropDownItems.Add(CreateMenuItem("Print",
AddressOf PrintFile_Click))
fileMenu.DropDownItems.Add(CreateMenuItem("Exit",
AddressOf ExitApplication_Click))
CODING:
Public Class Form1
Dim genderList As New List(Of String)
Private Sub SubmitButton_Click(sender As Object, e As EventArgs)
Handles
SubmitButton.Click
Dim gender As String = GenderTextBox.Text
genderList.Add(gender)
MessageBox.Show("Gender added successfully.")
End Sub
Private Sub AddButton_Click(sender As Object, e As EventArgs)
Handles
AddButton.Click
' Add your code to handle adding a new record here
End Sub
Private Sub DeleteButton_Click(sender As Object, e As EventArgs)
Handles
DeleteButton.Click
' Add your code to handle deleting a record here
End Sub
Private Sub UpdateButton_Click(sender As Object, e As EventArgs)
Handles
UpdateButton.Click
' Add your code to handle updating a record here
End Sub
End Class
Design window:
Output:
Program 8: date and time (output ok)
Coding:
Public Class Form1
' Button1 - Display Current Date and Time
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
' Get the current date and time
Dim currentDateTime As DateTime = DateTime.Now
' Display the current date and time
MessageBox.Show("Current Date and Time: " &
currentDateTime.ToString(), "Date & Time", MessageBoxButtons.OK,
MessageBoxIcon.Information)
End Sub
Return availableDoctor
End Function
' Button2 - Display Available Doctor in TextBox1
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles
Button2.Click
Dim currentTime As DateTime = DateTime.Now
Dim availableDoctor As String = GetAvailableDoctor(currentTime)
Design window:
Output: