-
Notifications
You must be signed in to change notification settings - Fork 0
/
BookList.vb
32 lines (26 loc) · 1.13 KB
/
BookList.vb
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
Imports System.Data.DataTable
Public Class BookList
Dim table As New DataTable("Table")
Private Sub GroupBox1_Enter(sender As Object, e As EventArgs) Handles GroupBox1.Enter
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
table.Rows.Add(TextBox1.Text, TextBox2.Text)
DataGridView1.DataSource = table
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If DataGridView1.SelectedRows.Count > 0 Then
DataGridView1.Rows.Remove(DataGridView1.SelectedRows(0))
Else
MessageBox.Show("Select 1 row before you hit Delete")
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
userpage.Show()
Me.Hide()
End Sub
Private Sub BookList_Load(sender As Object, e As EventArgs) Handles MyBase.Load
table.Columns.Add("BookName", Type.GetType("System.String"))
table.Columns.Add("Author", Type.GetType("System.String"))
DataGridView1.DataSource = table
End Sub
End Class