-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditCourseForm.cs
More file actions
47 lines (41 loc) · 1.37 KB
/
EditCourseForm.cs
File metadata and controls
47 lines (41 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace TinyCollege
{
public partial class EditCourseForm : Form
{
private string courseId;
public EditCourseForm(string courseId)
{
InitializeComponent();
this.courseId = courseId;
// Load course details into the form
// var course = Database.GetCourse(courseId);
// txtCourseName.Text = course.Name;
// txtCourseCode.Text = course.Code;
// txtCredits.Text = course.Credits.ToString();
}
private void btnSaveCourse_Click(object sender, EventArgs e)
{
// Code to update course information in the database
string courseName = txtCourseName.Text;
string courseCode = txtCourseCode.Text;
int credits;
if (int.TryParse(txtCredits.Text, out credits))
{
// Update course in the database
// Database.UpdateCourse(courseId, courseName, courseCode, credits);
MessageBox.Show("Course updated successfully.");
this.Close();
}
else
{
MessageBox.Show("Please enter valid credits.");
}
}
private void EditCourseForm_Load(object sender, EventArgs e)
{
}
}
}