Advertisement
Lewisg005

Untitled

Mar 28th, 2024
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VisualBasic 1.24 KB | Source Code | 0 0
  1. Imports System.Data.OleDb
  2.  
  3. Public Class FrmEvents
  4.  
  5.     Private Sub FrmEvents_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  6.         'this will pull up all of the values from the table tblEvents and laod them into a table in dgvEvents
  7.        SQL = "SELECT * FROM TblEvents;"
  8.         Cmd = New OleDbCommand(SQL, Con)
  9.         Dim SQLResults As DataTable = PerformCRUD(Cmd)
  10.         dgvEvents.DataSource = SQLResults
  11.  
  12.  
  13.     End Sub
  14.  
  15.     Private Sub dgvEvents_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvEvents.CellClick
  16.  
  17.         Dim thisrow As Integer = e.RowIndex
  18.         'when a cell is clicked all of the data for that record wil be loaded into the text boxes on the form
  19.        cmbEventID.Text = dgvEvents.Item(0, thisrow).Value
  20.         txtAgeGroup.Text = dgvEvents.Item(1, thisrow).Value
  21.         txtEventType.Text = dgvEvents.Item(2, thisrow).Value
  22.         txtGender.Text = dgvEvents.Item(3, thisrow).Value
  23.         txtTrackField.Text = dgvEvents.Item(3, thisrow).Value
  24.  
  25.  
  26.     End Sub
  27.  
  28.     Private Sub btnback_Click(sender As Object, e As EventArgs) Handles btnback.Click
  29.         frmAdmin.Show()
  30.         Me.Hide()
  31.  
  32.  
  33.     End Sub
  34. End Class
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement