Vb.net Project: With Coding

If numAge.Value < 1 OrElse numAge.Value > 100 Then MessageBox.Show("Age must be between 1 and 100.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Warning) Return False End If

Private Sub ClearFields() txtStudentID.Clear() txtName.Clear() numAge.Value = 18 txtCourse.Clear() txtName.Focus() End Sub

| Control Type | Name | Text / Purpose | |--------------|------|----------------| | Label | - | "Student Management System" (Font: bold) | | Label | - | "Student ID" | | TextBox | txtStudentID | (ReadOnly for auto-generated ID) | | Label | - | "Name" | | TextBox | txtName | | | Label | - | "Age" | | NumericUpDown | numAge | Minimum=1, Maximum=100 | | Label | - | "Course" | | TextBox | txtCourse | | | Button | btnAdd | Add Student | | Button | btnUpdate | Update | | Button | btnDelete | Delete | | Button | btnClear | Clear Fields | | TextBox | txtSearch | Search box | | Button | btnSearch | Search | | DataGridView | dgvStudents | (Dock: Bottom, Anchor: Top,Bottom,Left,Right) | Create a new module DatabaseHelper.vb : Vb.net Project With Coding

If rowsAffected > 0 Then MessageBox.Show("Student updated successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information) ClearFields() LoadAllStudents() Else MessageBox.Show("Student not found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End If End Using End Using End If End Sub

' Search by Name Private Sub btnSearch_Click(sender As Object, e As EventArgs) Handles btnSearch.Click Dim searchValue As String = txtSearch.Text.Trim() If numAge

conn.Open() cmd.ExecuteNonQuery() conn.Close() End Using End Using

Using conn As SqlConnection = GetConnection() Using cmd As New SqlCommand(query, conn) cmd.Parameters.AddWithValue("@Search", searchValue) Using adapter As New SqlDataAdapter(cmd) adapter.Fill(dataTable) End Using End Using End Using If numAge.Value &lt

' Validate input fields Private Function ValidateInputs() As Boolean If String.IsNullOrWhiteSpace(txtName.Text) Then MessageBox.Show("Name is required.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Warning) Return False End If

' Clear all input fields Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click ClearFields() End Sub

Reviews

Average Customer Review:
( 1 )
carla sires from Everett, WA United States
December 13, 2022
toner
great service at awesome pricing
Was this review helpful to you?
Empty Cart