Posted 08 February 2013 - 15:35
Posted 08 February 2013 - 16:09
Posted 08 February 2013 - 18:07
Posted 08 February 2013 - 20:10
Kalint, on 08 February 2013 - 18:00, said:
Public Class Mainmenu Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ExhibitorForm As New ExhibitorForm ExhibitorForm.ShowDialog() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim visitosForm As New VisitorsForm VisitorsForm.ShowDialog() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim PermanentStaff As New PermanentStaff PermanentStaff.ShowDialog() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim AgencyStaff As New AgencySatff AgencyStaff.ShowDialog() End Sub End Class
Dim MainForm As New MainForm MainForm.Show()
Posted 08 February 2013 - 21:14
Dr_Asik, on 08 February 2013 - 20:10, said:
Public Class Mainmenu Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ExhibitorForm As New ExhibitorForm ExhibitorForm.ShowDialog() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim visitosForm As New VisitorsForm VisitorsForm.ShowDialog() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim PermanentStaff As New PermanentStaff PermanentStaff.ShowDialog() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim AgencyStaff As New AgencySatff AgencyStaff.ShowDialog() End Sub End Class
Dim MainForm As New MainForm MainForm.Show()
Posted 09 February 2013 - 14:24
Dr_Asik, on 08 February 2013 - 20:10, said:
Public Class Mainmenu Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ExhibitorForm As New ExhibitorForm ExhibitorForm.ShowDialog() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim visitosForm As New VisitorsForm VisitorsForm.ShowDialog() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim PermanentStaff As New PermanentStaff PermanentStaff.ShowDialog() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim AgencyStaff As New AgencySatff AgencyStaff.ShowDialog() End Sub End Class
Dim MainForm As New MainForm MainForm.Show()
Public Class ExhibitorForm
Private Sub btnhome_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhome.Click
Dim MainMenu As New Mainmenu
Me.Hide()
MainMenu.Show()
End Sub
End Class
Posted 12 February 2013 - 13:49
Public Class Mainmenu
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ExhibitorForm As New ExhibitorForm
ExhibitorForm.ShowDialog()
End Sub
Public Class ExhibitorForm
Dim inc As Integer
Dim MaxRows As Integer
Dim con As New OleDb.OleDbConnection
Dim dbProvider As String
Dim dbSource As String
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
Dim cb As New OleDb.OleDbCommandBuilder(da)
Private Sub ExhibitorForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
dbProvider = "PROVIDER=Microsoft.ACE.OLEDB.12.0"
dbSource = "Data Source = Project.accdb"
con.ConnectionString = dbProvider & dbSource
con.Open()
sql = "SELECT * FROM tblExhibitorCompanies"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "Project")
MaxRows = ds.Tables("Project").Rows.Count
inc = -1
End Sub
Private Sub navigateRecords()
TxtCompID.Text = ds.Tables("Project").Rows(inc).Item(0)
TxtCompName.Text = ds.Tables("Project").Rows(inc).Item(1)
TxtCompAddress.Text = ds.Tables("Project").Rows(inc).Item(2)
TxtCompCity.Text = ds.Tables("Project").Rows(inc).Item(3)
TxtCompPhoneNum.Text = ds.Tables("Project").Rows(inc).Item(4)
TxtNumbStands.Text = ds.Tables("Project").Rows(inc).Item(5)
TxtPriceStands.Text = ds.Tables("Project").Rows(inc).Item(6)
End Sub
Private Sub btnprevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnprevious.Click
If inc > 0 Then
inc = inc - 1
navigateRecords()
ElseIf inc = -1 Then
MsgBox("No Records Yet")
ElseIf inc = 0 Then
MsgBox("First Record")
End If
End Sub
Private Sub btnnext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnext.Click
If inc <> MaxRows - 1 Then
inc = inc + 1
Else
MsgBox("No More Rows")
End If
End Sub
Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsave.Click
Dim cb As New OleDb.OleDbCommandBuilder(da)
ds.Tables("Project").Rows(inc).Item(0) = TxtCompID.Text
ds.Tables("Project").Rows(inc).Item(1) = TxtCompName.Text
ds.Tables("Project").Rows(inc).Item(2) = TxtCompAddress.Text
ds.Tables("Project").Rows(inc).Item(3) = TxtCompCity.Text
ds.Tables("Project").Rows(inc).Item(4) = TxtCompPhoneNum.Text
ds.Tables("Project").Rows(inc).Item(5) = TxtNumbStands.Text
ds.Tables("Project").Rows(inc).Item(6) = TxtPriceStands.Text
da.Update(ds, "AddressBook")
MsgBox("Data Updated")
If inc <> -1 Then
End If
Dim dsNewRow As DataRow
dsNewRow = ds.Tables("Project").NewRow()
dsNewRow.Item("CompanyID") = TxtCompID.Text
dsNewRow.Item("CompanyName") = TxtCompName.Text
dsNewRow.Item("CompanyAddress") = TxtCompAddress.Text
dsNewRow.Item("City") = TxtCompCity.Text
dsNewRow.Item("TelephoneNumber") = TxtCompPhoneNum.Text
dsNewRow.Item("NumberofStands") = TxtNumbStands.Text
dsNewRow.Item("PriceofStands") = TxtPriceStands.Text
ds.Tables("AddressBook").Rows.Add(dsNewRow)
da.Update(ds, "AddressBook")
MsgBox("New Record added to the Database")
btnsave.Enabled = False
btnadd.Enabled = True
btnedit.Enabled = True
btndelete.Enabled = True
End Sub
Private Sub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadd.Click
btnsave.Enabled = True
btnadd.Enabled = False
btnedit.Enabled = False
btndelete.Enabled = False
TxtCompID.Clear()
TxtCompName.Clear()
TxtCompAddress.Clear()
TxtCompCity.Clear()
TxtCompPhoneNum.Clear()
TxtNumbStands.Clear()
TxtPriceStands.Clear()
End Sub
Private Sub btndelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndelete.Click
Dim cb As New OleDb.OleDbCommandBuilder(da)
If MessageBox.Show("Please confirm you want to Delete this Record?", "Delete", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) = Windows.Forms.DialogResult.No Then
MsgBox("Operation Canceled")
Exit Sub
End If
ds.Tables("Project").Rows(inc).Delete()
MaxRows = MaxRows - 1
inc = 0
navigateRecords()
da.Update(ds, "Project")
End Sub
End Class
Posted 13 February 2013 - 12:46
puppet_master, on 12 February 2013 - 13:49, said:
Public Class Mainmenu Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ExhibitorForm As New ExhibitorForm ExhibitorForm.ShowDialog() End Sub
Private Sub ExhibitorForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load dbProvider = "PROVIDER=Microsoft.ACE.OLEDB.12.0" dbSource = "Data Source = Project.accdb" con.ConnectionString = dbProvider & dbSource con.Open()
Posted 14 February 2013 - 09:02
puppet_master, on 13 February 2013 - 22:24, said:
' as you can see below you have two variables one for provider, one for source ' dbProvider = "PROVIDER=Microsoft.ACE.OLEDB.12.0" dbSource = "Data Source = Project.accdb" 'here you are combining them into a connection string, with the ; separator, you end up with an invalid connection string' con.ConnectionString = dbProvider & dbSource 'Simply add ; to the end of the provider string as such' dbProvider = "PROVIDER=Microsoft.ACE.OLEDB.12.0;"