Imports System.Data.SqlClient
Imports System
Imports System.Data
Imports System.Windows.Forms.DataGridView
Public Class Cust_info
Dim monthsTotal As Integer
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim SqlConnection As New SqlClient.SqlConnection
SqlConnection.ConnectionString = "Data Source=ADDYADNAN-PC\SQLEXPRESS;Initial Catalog=CBTS;Integrated Security=True"
'TODO: This line of code loads data into the 'CBTSDataSet.customer_info' table. You can move, or remove it, as needed.
Me.Customer_infoTableAdapter.Fill(Me.CBTSDataSet.customer_info)
Me.BringToFront()
Me.Show()
c_Id_Text.Enabled = False
c_Name_Text.Enabled = False
DateTimePickerStart.Enabled = False
DateTimePickerEnd.Enabled = False
con_amnt.Enabled = False
con_period.Enabled = False
payMethod.Enabled = False
End Sub
Private Sub AddCustBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddCustBtn.Click
Me.CustomerinfoBindingSource.AddNew()
c_Id_Text.Enabled = True
c_Name_Text.Enabled = True
DateTimePickerStart.Enabled = True
DateTimePickerEnd.Enabled = True
con_amnt.Enabled = True
con_period.Enabled = True
payMethod.Enabled = True
End Sub
Private Sub delCustInfo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles delCustInfo.Click
Me.CustomerinfoBindingSource.RemoveCurrent()
c_Id_Text.Enabled = True
c_Name_Text.Enabled = True
DateTimePickerStart.Enabled = True
DateTimePickerEnd.Enabled = True
con_amnt.Enabled = True
con_period.Enabled = True
payMethod.Enabled = True
End Sub
Private Sub reset1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles reset1.Click
c_Id_Text.Clear()
c_Name_Text.Clear()
DateTimePickerStart.ResetText()
DateTimePickerEnd.ResetText()
con_amnt.Clear()
con_period.Clear()
Pay_method.ResetText()
End Sub
Private Sub ExitCustInfo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitCustInfo.Click
ExitDialog.BringToFront()
ExitDialog.Activate()
ExitDialog.Show()
End Sub
Private Sub back2menu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles back2menu.Click
Me.Hide()
FrontPage.BringToFront()
FrontPage.Activate()
FrontPage.Show()
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)
End Sub
Private Sub DateTimePickerStart_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePickerStart.ValueChanged
End Sub
Private Sub DateTimePickerEnd_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePickerEnd.ValueChanged
End Sub
Private Sub ButCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButCalc.Click
Dim Con_Start1 As Date = DateTimePickerStart.Value
Dim con_end1 As Date = DateTimePickerEnd.Value
monthsTotal = DateDiff(DateInterval.Month, Con_Start1, con_end1)
Me.con_period.Text = monthsTotal
End Sub
Private Sub c_Id_Text_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles c_Id_Text.TextChanged
End Sub
Private Sub c_Name_Text_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles c_Name_Text.TextChanged
End Sub
Private Sub con_amnt_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles con_amnt.TextChanged
End Sub
Private Sub con_period_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles con_period.TextChanged
End Sub
Private Sub Pay_method_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Pay_method.SelectedIndexChanged
End Sub
Private Sub DataGridView1_CellContentClick_1(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
End Sub
Private Sub DateTimePicker2_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePickerEnd.ValueChanged
End Sub
Private Sub FillByToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Try
Me.Customer_infoTableAdapter.FillBy(Me.CBTSDataSet.customer_info)
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub updateBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles updateBtn.Click
Me.Validate()
Me.CustomerinfoBindingSource.EndEdit()
Me.Customer_infoTableAdapter.Update(Me.CBTSDataSet.customer_info)
MessageBox.Show("Data has been Updated")
End Sub
End Class
This post has been edited by yukirou: 14 April 2010 - 08:12 PM

New Topic/Question
Reply




MultiQuote


|