form retun books için
Imports System.Data.OleDb
Imports System.Data
Public Class returnbooks
Dim c As Integer
Dim con As New OleDbConnection(str)
Dim adp1, adp2, adp3 As OleDbDataAdapter
Dim ds1, ds2, ds3 As New DataSet
Dim cmdb As OleDbCommandBuilder
Dim dr As OleDbDataReader
Dim cmd As OleDbCommand
Private Sub returnbooks_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.Open()
adp1 = New OleDbDataAdapter("select * from issue", con)
adp2 = New OleDbDataAdapter("select * from return", con)
adp3 = New OleDbDataAdapter("select * from book", con)
bind()
End Sub
Private Sub bind()
ComboBox1.Items.Clear()
adp1.Fill(ds1, "i")
Dim dr As DataRow
For Each dr In ds1.Tables(0).Rows()
If ComboBox1.Items.Contains(dr.Item("bookname")) = False Then
ComboBox1.Items.Add(dr.Item("bookname"))
End If
Next
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
ComboBox2.Items.Clear()
Dim dr As DataRow
For Each dr In ds1.Tables(0).Rows()
If (dr.Item("bookname")) = ComboBox1.SelectedItem.ToString Then
TextBox1.Text = dr.Item("bookcode")
ComboBox2.Items.Add(dr.Item("studentname"))
End If
Next
End Sub
Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
ComboBox3.Items.Clear()
ComboBox3.Text = ""
Dim dr As DataRow
For Each dr In ds1.Tables(0).Rows()
If (dr.Item("studentname")) = ComboBox2.SelectedItem.ToString Then
If ComboBox3.Items.Contains(dr.Item("studentcourse")) = False Then
ComboBox3.Items.Add(dr.Item("studentcourse"))
End If
TextBox2.Text = dr.Item("booknumber")
TextBox3.Text = dr.Item("dateofissue")
TextBox4.Text = Format(Today.Date, "D")
End If
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
On Error GoTo es
adp2.Fill(ds2, "r")
adp3.Fill(ds3, "r")
Dim dr As DataRow
dr = ds2.Tables(0).NewRow
dr(0) = TextBox1.Text
dr(1) = ComboBox1.SelectedItem.ToString
dr(2) = ComboBox2.SelectedItem.ToString
dr(3) = 0
dr(4) = ComboBox3.SelectedItem.ToString
dr(5) = CInt(TextBox2.Text)
dr(6) = CDate(TextBox3.Text)
dr(7) = CDate(TextBox4.Text)
ds2.Tables(0).Rows.Add(dr)
cmdb = New OleDbCommandBuilder(adp2)
adp2.Update(ds2, "r")
Button1.Enabled = False
cmd = New OleDbCommand("delete from issue where bookcode=''''" & TextBox1.Text & "''''and studentname=''''" & ComboBox2.Text & "'''' and studentcourse=''''" & ComboBox3.Text & "'''' and booknumber=" & TextBox2.Text, con)
MsgBox(cmd.CommandText)
cmd.ExecuteNonQuery()
cmd = New OleDbCommand("select issued from book where bookcode=''''" & TextBox1.Text & "''''", con)
c = cmd.ExecuteScalar
Dim cmd2 As New OleDbCommand("update book set issued=" & c - 1 & " where bookcode=''''" & TextBox1.Text & "''''", con)
cmd2.ExecuteNonQuery()
Button2.PerformClick()
Exit Sub
es:
MsgBox(Err.Description)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ComboBox1.Items.Clear()
ComboBox2.Items.Clear()
ComboBox3.Items.Clear()
ComboBox1.Text = ""
ComboBox2.Text = ""
ComboBox3.Text = ""
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Button1.Enabled = True
bind()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
con.Close()
Me.Close()
mainform.Show()
End Sub
End Class
main form için
Public Class mainform
Private Sub mainform_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Width = Me.Width
Label2.Text = Now
End Sub
Private Sub Button1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseLeave
Button1.BackColor = Color.Silver
Button1.ForeColor = Color.Black
End Sub
Private Sub Button1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseMove
Button1.BackColor = Color.Purple
Button1.ForeColor = Color.White
End Sub
Private Sub Button2_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.MouseLeave
lv(sender)
End Sub
Private Sub lv(ByVal sender As Object)
sender.BackColor = Color.Silver
sender.ForeColor = Color.Black
End Sub
Private Sub mv(ByVal sender As Object)
sender.BackColor = Color.Purple
sender.ForeColor = Color.White
End Sub
Private Sub Button2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button2.MouseMove
mv(sender)
End Sub
Private Sub Button3_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.MouseLeave
lv(sender)
End Sub
Private Sub Button3_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button3.MouseMove
mv(sender)
End Sub
Private Sub Button4_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.MouseLeave
lv(sender)
End Sub
Private Sub Button4_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button4.MouseMove
mv(sender)
End Sub
Private Sub Button5_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.MouseLeave
lv(sender)
End Sub
Private Sub Button5_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button5.MouseMove
mv(sender)
End Sub
Private Sub Button6_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button6.MouseLeave
lv(sender)
End Sub
Private Sub Button6_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button6.MouseMove
mv(sender)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label2.Text = Now
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Me.Close()
End Sub
Private Sub Button8_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button8.MouseLeave
lv(sender)
End Sub
Private Sub Button8_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button8.MouseMove
mv(sender)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
courseform.Show()
Me.Hide()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
student.Show()
Me.Hide()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
bookform.Show()
Me.Hide()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
issuebooks.Show()
Me.Hide()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
returnbooks.Show()
Me.Hide()
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
searchbooks.Show()
End Sub
End Class
viewallbooks formu için
Public Class viewallbooks
Dim bk As New dbase("book")
Dim i, j As Integer
Private Sub viewallbooks_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DataGridView1.DataSource = bk.dt
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
bookform.Show()
Me.Close()
bk.con.Close()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
searchbooks.Show()
Me.Close()
End Sub
End Class
student formu için
Public Class student
Dim stu As New dbase("student")
Dim cou As New dbase("course")
Dim dr() As DataRow
Dim p As Integer
Private Sub student_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
End Sub
Private Sub student_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.DataBindings.Add("text", stu.dt, "studentcode")
TextBox2.DataBindings.Add("text", stu.dt, "studentname")
TextBox3.DataBindings.Add("text", stu.dt, "studentfname")
TextBox4.DataBindings.Add("text", stu.dt, "studentcourse")
TextBox5.DataBindings.Add("text", stu.dt, "studentsem")
TextBox6.DataBindings.Add("text", stu.dt, "fine")
ComboBox1.DataSource = cou.dt
ComboBox1.DisplayMember = "coursename"
End Sub
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
focuse(e.KeyChar, TextBox2)
End Sub
Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
focuse(e.KeyChar, TextBox3)
End Sub
Private Sub TextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress
focuse(e.KeyChar, ComboBox1)
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Me.BindingContext(stu.dt).Position += 1
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Me.BindingContext(stu.dt).Position -= 1
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Me.BindingContext(stu.dt).Position = 0
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
Me.BindingContext(stu.dt).Position = Me.BindingContext(stu.dt).Count - 1
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Button2.Enabled = True
Me.BindingContext(stu.dt).AddNew()
TextBox4.Visible = False
TextBox5.Visible = False
TextBox4.Text = ComboBox1.Text
TextBox5.Text = ComboBox2.Text
TextBox6.Text = 0
TextBox1.Focus()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Button2.Enabled = False
On Error GoTo er
TextBox6.Text = 0
Me.BindingContext(stu.dt).EndCurrentEdit()
stu.save()
TextBox4.Visible = True
TextBox5.Visible = True
Exit Sub
er:
MsgBox(Err.Description)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.BindingContext(stu.dt).RemoveAt(Me.BindingContext(stu.dt).Position)
Button2.PerformClick()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.BindingContext(stu.dt).CancelCurrentEdit()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
mainform.Show()
Me.Close()
stu.con.Close()
cou.con.Close()
End Sub
Private Sub ComboBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress
focuse(e.KeyChar, ComboBox2)
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
TextBox4.Text = ComboBox1.Text
End Sub
Private Sub ComboBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ComboBox2.KeyPress
focuse(e.KeyChar, Button2)
End Sub
Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
TextBox5.Text = ComboBox2.Text
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub Label5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label5.Click
End Sub
End Class
splashscreen ekleyin
Public NotInheritable Class SplashScreen1
''''TODO: This form can easily be set as the splash screen for the application by going to the "Application" tab
'''' of the Project Designer ("Properties" under the "Project" menu).
Private Sub SplashScreen1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
''''Set up the dialog text at runtime according to the application''''s assembly information.
''''TODO: Customize the application''''s assembly information in the "Application" pane of the project
'''' properties dialog (under the "Project" menu).
''''Application title
If My.Application.Info.Title <> "" Then
ApplicationTitle.Text = My.Application.Info.Title
Else
''''If the application title is missing, use the application name, without the extension
ApplicationTitle.Text = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName)
End If
''''Format the version information using the text set into the Version control at design time as the
'''' formatting string. This allows for effective localization if desired.
'''' Build and revision information could be included by using the following code and changing the
'''' Version control''''s designtime text to "Version {0}.{1:00}.{2}.{3}" or something similar. See
'''' String.Format() in Help for more information.
''''
'''' Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor, My.Application.Info.Version.Build, My.Application.Info.Version.Revision)
Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor)
''''Copyright info
Copyright.Text = My.Application.Info.Copyright
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub ApplicationTitle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ApplicationTitle.Click
LoginForm1.Show()
Me.Close()
End Sub
End Class