running32
asked on
Additional information: Cannot access a disposed object named "DataGridTextBox".
I have a windows form and when I click on the datagrid to take me to another form I get the error Additional information: Cannot access a disposed object named "DataGridTextBox".
I am trying to close the form which has two datagrids on it. When I click on datagrid1 I get the error but datagrid2 does not give me the error.
Thank you
I am trying to close the form which has two datagrids on it. When I click on datagrid1 I get the error but datagrid2 does not give me the error.
Thank you
mports Splash.Global
Imports VB = Microsoft.VisualBasic
Imports System.Data.SQLClient
Imports System.Data.OleDb
Imports System.Data.Odbc
Public Class frmcheckin
Inherits System.Windows.Forms.Form
Dim count
Dim memberid
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Friend WithEvents GroupBox6 As System.Windows.Forms.GroupBox
Friend WithEvents Label8 As System.Windows.Forms.Label
Friend WithEvents ComboBox2 As System.Windows.Forms.ComboBox
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
Friend WithEvents Button9 As System.Windows.Forms.Button
Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
Friend WithEvents Label19 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents OleDbSelectCommand1 As System.Data.OleDb.OleDbCommand
Friend WithEvents OleDbInsertCommand1 As System.Data.OleDb.OleDbCommand
Friend WithEvents OleDbUpdateCommand1 As System.Data.OleDb.OleDbCommand
Friend WithEvents OleDbDeleteCommand1 As System.Data.OleDb.OleDbCommand
Friend WithEvents OleDbDataAdapter1 As System.Data.OleDb.OleDbDataAdapter
Friend WithEvents DataGrid2 As System.Windows.Forms.DataGrid
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Timer1 As System.Windows.Forms.Timer
Friend WithEvents Label3 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmcheckin))
Me.Label6 = New System.Windows.Forms.Label
Me.PictureBox1 = New System.Windows.Forms.PictureBox
Me.GroupBox6 = New System.Windows.Forms.GroupBox
Me.Label8 = New System.Windows.Forms.Label
Me.ComboBox2 = New System.Windows.Forms.ComboBox
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.Label1 = New System.Windows.Forms.Label
Me.RadioButton2 = New System.Windows.Forms.RadioButton
Me.RadioButton1 = New System.Windows.Forms.RadioButton
Me.Button9 = New System.Windows.Forms.Button
Me.TextBox4 = New System.Windows.Forms.TextBox
Me.Label19 = New System.Windows.Forms.Label
Me.DataGrid1 = New System.Windows.Forms.DataGrid
Me.Label2 = New System.Windows.Forms.Label
Me.OleDbSelectCommand1 = New System.Data.OleDb.OleDbCommand
Me.OleDbInsertCommand1 = New System.Data.OleDb.OleDbCommand
Me.OleDbUpdateCommand1 = New System.Data.OleDb.OleDbCommand
Me.OleDbDeleteCommand1 = New System.Data.OleDb.OleDbCommand
Me.OleDbDataAdapter1 = New System.Data.OleDb.OleDbDataAdapter
Me.DataGrid2 = New System.Windows.Forms.DataGrid
Me.Label4 = New System.Windows.Forms.Label
Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
Me.Label3 = New System.Windows.Forms.Label
Me.GroupBox6.SuspendLayout()
Me.GroupBox1.SuspendLayout()
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.DataGrid2, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Label6
'
Me.Label6.Location = New System.Drawing.Point(16, 48)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(176, 17)
Me.Label6.TabIndex = 49
Me.Label6.Text = "Current Member Activity"
'
'PictureBox1
'
Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)
Me.PictureBox1.Location = New System.Drawing.Point(472, 8)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(592, 104)
Me.PictureBox1.TabIndex = 58
Me.PictureBox1.TabStop = False
'
'GroupBox6
'
Me.GroupBox6.Controls.Add(Me.Label8)
Me.GroupBox6.Controls.Add(Me.ComboBox2)
Me.GroupBox6.Location = New System.Drawing.Point(472, 240)
Me.GroupBox6.Name = "GroupBox6"
Me.GroupBox6.Size = New System.Drawing.Size(216, 96)
Me.GroupBox6.TabIndex = 66
Me.GroupBox6.TabStop = False
Me.GroupBox6.Text = "LOCATION"
'
'Label8
'
Me.Label8.Location = New System.Drawing.Point(8, 56)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing.Size(192, 32)
Me.Label8.TabIndex = 55
Me.Label8.Text = "To change pool location please contact your administrator."
'
'ComboBox2
'
Me.ComboBox2.Location = New System.Drawing.Point(8, 24)
Me.ComboBox2.Name = "ComboBox2"
Me.ComboBox2.Size = New System.Drawing.Size(152, 21)
Me.ComboBox2.TabIndex = 0
Me.ComboBox2.TabStop = False
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.Label1)
Me.GroupBox1.Controls.Add(Me.RadioButton2)
Me.GroupBox1.Controls.Add(Me.RadioButton1)
Me.GroupBox1.Controls.Add(Me.Button9)
Me.GroupBox1.Controls.Add(Me.TextBox4)
Me.GroupBox1.Controls.Add(Me.Label19)
Me.GroupBox1.Location = New System.Drawing.Point(472, 120)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(592, 112)
Me.GroupBox1.TabIndex = 69
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Search"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(112, 48)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(272, 16)
Me.Label1.TabIndex = 73
Me.Label1.Text = "Type in Last Name, First Name (exp: Person, Test)"
Me.Label1.Visible = False
'
'RadioButton2
'
Me.RadioButton2.Location = New System.Drawing.Point(472, 48)
Me.RadioButton2.Name = "RadioButton2"
Me.RadioButton2.Size = New System.Drawing.Size(112, 24)
Me.RadioButton2.TabIndex = 72
Me.RadioButton2.Text = "Member Number"
'
'RadioButton1
'
Me.RadioButton1.Location = New System.Drawing.Point(472, 24)
Me.RadioButton1.Name = "RadioButton1"
Me.RadioButton1.Size = New System.Drawing.Size(72, 24)
Me.RadioButton1.TabIndex = 71
Me.RadioButton1.Text = "Name"
'
'Button9
'
Me.Button9.Location = New System.Drawing.Point(24, 72)
Me.Button9.Name = "Button9"
Me.Button9.Size = New System.Drawing.Size(168, 24)
Me.Button9.TabIndex = 70
Me.Button9.TabStop = False
Me.Button9.Text = "Search Members"
'
'TextBox4
'
Me.TextBox4.BackColor = System.Drawing.Color.Red
Me.TextBox4.Location = New System.Drawing.Point(112, 24)
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.Size = New System.Drawing.Size(352, 20)
Me.TextBox4.TabIndex = 67
Me.TextBox4.Text = ""
'
'Label19
'
Me.Label19.Location = New System.Drawing.Point(16, 24)
Me.Label19.Name = "Label19"
Me.Label19.Size = New System.Drawing.Size(96, 16)
Me.Label19.TabIndex = 69
Me.Label19.Text = "Member Name"
'
'DataGrid1
'
Me.DataGrid1.DataMember = ""
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(472, 360)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(592, 144)
Me.DataGrid1.TabIndex = 72
Me.DataGrid1.Visible = False
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(472, 344)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(56, 16)
Me.Label2.TabIndex = 73
Me.Label2.Text = "Results"
Me.Label2.Visible = False
'
'OleDbDataAdapter1
'
Me.OleDbDataAdapter1.DeleteCommand = Me.OleDbDeleteCommand1
Me.OleDbDataAdapter1.InsertCommand = Me.OleDbInsertCommand1
Me.OleDbDataAdapter1.SelectCommand = Me.OleDbSelectCommand1
Me.OleDbDataAdapter1.UpdateCommand = Me.OleDbUpdateCommand1
'
'DataGrid2
'
Me.DataGrid2.AllowNavigation = False
Me.DataGrid2.AllowSorting = False
Me.DataGrid2.CaptionVisible = False
Me.DataGrid2.CausesValidation = False
Me.DataGrid2.ColumnHeadersVisible = False
Me.DataGrid2.DataMember = ""
Me.DataGrid2.FlatMode = True
Me.DataGrid2.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid2.Location = New System.Drawing.Point(8, 72)
Me.DataGrid2.Name = "DataGrid2"
Me.DataGrid2.ParentRowsVisible = False
Me.DataGrid2.ReadOnly = True
Me.DataGrid2.RowHeadersVisible = False
Me.DataGrid2.Size = New System.Drawing.Size(416, 480)
Me.DataGrid2.TabIndex = 74
'
'Label4
'
Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label4.Location = New System.Drawing.Point(16, 16)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(232, 16)
Me.Label4.TabIndex = 76
'
'Timer1
'
Me.Timer1.Enabled = True
Me.Timer1.Interval = 1
'
'Label3
'
Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label3.Location = New System.Drawing.Point(256, 16)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(128, 16)
Me.Label3.TabIndex = 77
'
'frmcheckin
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.AutoScroll = True
Me.ClientSize = New System.Drawing.Size(1120, 558)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.DataGrid2)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.DataGrid1)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.GroupBox6)
Me.Controls.Add(Me.PictureBox1)
Me.Controls.Add(Me.Label6)
Me.Name = "frmcheckin"
Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
Me.GroupBox6.ResumeLayout(False)
Me.GroupBox1.ResumeLayout(False)
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.DataGrid2, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Public da As OleDbDataAdapter
Dim cmd As OleDbCommand
' Dim conn As New OdbcDataAdapter
Dim fsConn As String
Dim fsTable As String
Dim fsDBName As String
Dim ds As New DataSet
Dim dv As New DataView
Dim cn1 As New OleDbConnection
Dim sConn As String = "Driver={Microsoft Access Driver (*.mdb)};Dbq=c:\Splash\Splash.mdb;Uid=Admin;Pwd=;" '<<< note the change here
Private Sub frmcheckin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RadioButton1.Checked = True
Dim Parent As frmSplash = CType(Me.MdiParent, frmSplash)
Parent.Button1.Enabled = True
If admin = True Then
Parent.Button5.Visible = True
' Parent.Button3.Visible = True
End If
Me.Size = New Size(Me.MdiParent.Size.Width - 15, Me.MdiParent.Size.Height - 75)
'connect to the dbase...and open it...
Dim todaysdate
todaysdate = Now.ToShortDateString()
datagrid2update()
'Get pool name
Dim sConn As String = "Driver={Microsoft Access Driver (*.mdb)};Dbq=c:\Splash\Splash.mdb;Uid=Admin;Pwd=;" '<<< note the change here
Dim cn As New OdbcConnection(sConn)
Dim sSQL1 As String = "select strpoolname, lngpoolid from tblpoolname where lngpoolid = " & Splash.Global.poolid
Dim da1 As New OdbcDataAdapter(sSQL1, cn)
Dim ds1 As New DataSet
Try
Dim count
da1.Fill(ds1)
' DataGrid1.DataSource = ds.Tables(0)
Catch ex As Exception
MsgBox(ex.Message)
End Try
ComboBox2.DataSource = ds1.Tables(0)
Me.ComboBox2.DisplayMember = "strpoolname"
Me.ComboBox2.ValueMember = "lngpoolid"
poolname = ds1.Tables(0).Rows(0).Item("strpoolname")
End Sub
Public Sub datagrid2update()
Dim Connection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Splash\Splash.mdb")
' Dim Command As String = "select tblcheckin.dtmcheckin, tblmember.strfname & ' ' & tblmember.strlname as Name from tblMember inner join tblcheckin on tblmember.lngid = tblcheckin.lngid where lngtype = '" & 1 & "' and CONVERT(char(10), dtmcheckin, 101) =" & todaysdate
'Dim Command As String = "select tc1.*, tc1.lngtype from tblcheckin as tc1 inner join (select tc.lngid, max(tc.dtmcheckin) as dt from tblcheckin as tc group by tc.lngid) as x on tc1.lngid = x.lngid and tc1.dtmcheckin = x.dt where lngtype = 1 and dtmcheckin >= date() and dtmcheckin < dateadd(""d"", 1, date()) "
Dim Command As String
Dim ds As New DataSet
Dim dt As DataTable
Dim dr As DataRow
'Command = "select tc1.*, tc1.lngtype, tblmember.[strfname] & ' ' & tblmember.[strlname] AS [Name] FROM (tblcheckin AS tc1 INNER JOIN (select tc.lngid, max(tc.dtmcheckin) as dt from tblcheckin as tc group by tc.lngid) AS x ON (tc1.dtmcheckin = x.dt) AND (tc1.lngid = x.lngid)) INNER JOIN tblmember ON tc1.lngid = tblmember.lngid WHERE (((tc1.lngtype)=1) AND ((tc1.dtmcheckin)>=Date() And (tc1.dtmcheckin)<DateAdd(""d"",1,Date())))"
Command = "select tc1.*, tc1.lngtype, tblmember.[strfname] & ' ' & tblmember.[strlname] AS [Name] FROM (tblcheckin AS tc1 INNER JOIN (select tc.lngid, max(tc.dtmcheckin) as dt from tblcheckin as tc group by tc.lngid) AS x ON (tc1.dtmcheckin = x.dt) AND (tc1.lngid = x.lngid)) INNER JOIN tblmember ON tc1.lngid = tblmember.lngid WHERE (((tc1.lngtype)=1) AND ((tc1.dtmcheckin)>=Date() And (tc1.dtmcheckin)<DateAdd(""d"",1,Date())))"
'fill the listview control with the data...
da = New OleDbDataAdapter(Command, Connection)
ds.Tables.Clear()
Try
' Dim count
count = da.Fill(ds)
DataGrid2.DataSource = ds.Tables(0)
Catch ex As Exception
' MsgBox(ex.Message)
End Try
Dim tablestyle As New DataGridTableStyle
tablestyle.MappingName = ds.Tables(0).TableName
Dim column5 As New DataGridTextBoxColumn
column5.MappingName = "dtmcheckin"
column5.Width = 110
column5.HeaderText = "Date"
tablestyle.GridColumnStyles.Add(column5)
column5 = New DataGridTextBoxColumn
column5.MappingName = "lngid"
column5.Width = 1
tablestyle.GridColumnStyles.Add(column5)
column5 = New DataGridTextBoxColumn
column5.MappingName = "Name"
column5.Width = 170
column5.HeaderText = "Member who checked in guests"
tablestyle.GridColumnStyles.Add(column5)
DataGrid2.TableStyles.Clear()
Me.DataGrid2.TableStyles.Add(tablestyle)
End Sub
Private Sub Button9_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
If TextBox4.Text = "" Then
MsgBox("Please enter search criteria!")
Exit Sub
End If
Dim sConn As String = "Driver={Microsoft Access Driver (*.mdb)};Dbq=c:\Splash\Splash.mdb;Uid=Admin;Pwd=;" '<<< note the change here
Dim cn As New OdbcConnection(sConn)
Try
cn.Open()
Catch ex As Exception
MsgBox(ex.Message)
End Try
If RadioButton2.Checked = True Then
Splash.Global.memberid = TextBox4.Text
Dim sSQL As String = "select lngmemberid ,strfname & ' ' & strlname as name, age from tblmember where lngmemberid = '" & TextBox4.Text & "'"
Dim da As New OdbcDataAdapter(sSQL, cn)
Dim ds As New DataSet
Try
count = da.Fill(ds)
Catch ex As Exception
MsgBox(ex.Message)
End Try
If count = 0 Then
MsgBox("No matches in database!")
Exit Sub
Else
If IsDBNull(ds.Tables(0).Rows(0).Item("lngmemberid")) = False Then
Splash.Global.memberid = ds.Tables(0).Rows(0).Item("lngmemberid")
Dim frmMain As New frmMain
Dim myParent = Me.MdiParent
'replace Form1 with type of the MDI form
With frmMain
.MdiParent = myParent
' Me.Close()
.Show()
End With
End If
End If
End If
If RadioButton1.Checked = True Then
Dim lenght, seperator, fname, lname
lenght = Len(TextBox4.Text)
seperator = InStr(TextBox4.Text, ",")
If seperator > 0 Then
fname = Mid(TextBox4.Text, seperator + 1, lenght - seperator)
fname = fname.Replace(" ", "") 'Remove all spaces
lname = Mid(TextBox4.Text, 1, seperator - 1)
Dim sSQL As String = "select lngmemberid ,strfname & ' ' & strlname as name, age from tblmember where strlname like'" & lname & "%' and strfname like'" & fname & "%' order by strfname"
Dim da As New OdbcDataAdapter(sSQL, cn)
Dim ds As New DataSet
Try
Dim count
count = da.Fill(ds)
If count = 0 Then
MsgBox("No matches in database!")
Exit Sub
End If
If count = 1 Then
If IsDBNull(ds.Tables(0).Rows(0).Item("lngmemberid")) = False Then
Splash.Global.memberid = ds.Tables(0).Rows(0).Item("lngmemberid")
Dim frmMain As New frmMain
Dim myParent = Me.MdiParent
'replace Form1 with type of the MDI form
With frmMain
.MdiParent = myParent
' Me.Close()
.Show()
End With
End If
Else
DataGrid1.TableStyles.Clear()
DataGrid1.Visible = True
DataGrid1.DataSource = ds.Tables(0)
Dim tablestyle As New DataGridTableStyle
tablestyle.MappingName = ds.Tables(0).TableName
Dim column5 As New DataGridTextBoxColumn
column5.MappingName = "Name"
column5.Width = 140
column5.HeaderText = "Name"
tablestyle.GridColumnStyles.Add(column5)
column5 = New DataGridTextBoxColumn
column5.MappingName = "age"
column5.Width = 100
column5.HeaderText = "Age"
tablestyle.GridColumnStyles.Add(column5)
column5 = New DataGridTextBoxColumn
column5.MappingName = "lngmemberid"
column5.Width = 0
tablestyle.GridColumnStyles.Add(column5)
Me.DataGrid1.TableStyles.Clear()
Me.DataGrid1.TableStyles.Add(tablestyle)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
ElseIf seperator = 0 Then
lname = TextBox4.Text
Dim sSQL As String = "select lngmemberid, strfname & ' ' & strlname as name, age from tblmember where strlname like '" & lname & "%'order by strfname "
Dim da As New OdbcDataAdapter(sSQL, cn)
Dim ds As New DataSet
Try
Dim count
count = da.Fill(ds)
If count = 0 Then
MsgBox("No matches in database!")
Exit Sub
End If
If count = 1 Then
If IsDBNull(ds.Tables(0).Rows(0).Item("lngmemberid")) = False Then
Splash.Global.memberid = ds.Tables(0).Rows(0).Item("lngmemberid")
Dim frmMain As New frmMain
Dim myParent = Me.MdiParent
'replace Form1 with type of the MDI form
With frmMain
.MdiParent = myParent
Me.Close()
.Show()
End With
End If
Else
DataGrid1.Visible = True
DataGrid1.DataSource = ds.Tables(0)
Dim tablestyle As New DataGridTableStyle
tablestyle.MappingName = ds.Tables(0).TableName
Dim column5 As New DataGridTextBoxColumn
column5.MappingName = "Name"
column5.Width = 140
column5.HeaderText = "Name"
tablestyle.GridColumnStyles.Add(column5)
column5 = New DataGridTextBoxColumn
column5.MappingName = "age"
column5.Width = 100
column5.HeaderText = "Age"
tablestyle.GridColumnStyles.Add(column5)
column5 = New DataGridTextBoxColumn
column5.MappingName = "lngmemberid"
column5.Width = 0
tablestyle.GridColumnStyles.Add(column5)
Me.DataGrid1.TableStyles.Clear()
Me.DataGrid1.TableStyles.Add(tablestyle)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
'frmloading.Hide()
End If
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
If RadioButton2.Checked Then
Label19.Text = "Member Number"
Label1.Visible = False
DataGrid1.Visible = False
Label2.Visible = False
End If
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
Label1.Visible = True
DataGrid1.Visible = True
Label2.Visible = True
End Sub
Private Sub DataGrid1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseDown
Dim pt = New Point(e.X, e.Y)
Dim hti As DataGrid.HitTestInfo = DataGrid1.HitTest(pt)
If hti.Type = DataGrid.HitTestType.Cell Then
DataGrid1.CurrentCell = New DataGridCell(hti.Row, hti.Column)
DataGrid1.Select(hti.Row)
Splash.Global.memberid = DataGrid1.Item(hti.Row, 2) 'Column 3
End If
Dim frmMain As New frmMain
Dim myParent = Me.MdiParent
'replace Form1 with type of the MDI form
With frmMain
.MdiParent = myParent
Me.Close()
.Show()
End With
End Sub
Private Sub frmcheckin_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Leave
DataGrid1.Visible = False
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim frmMain As New frmemergencycontacts
Dim myParent = Me.MdiParent
'replace Form1 with type of the MDI form
With frmMain
.MdiParent = myParent
' Me.Close()
.Show()
End With
End Sub
Private Sub DataGrid2_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGrid2.MouseDown
Dim pt = New Point(e.X, e.Y)
Dim hti As DataGrid.HitTestInfo = DataGrid2.HitTest(pt)
If hti.Type = DataGrid.HitTestType.Cell Then
DataGrid2.CurrentCell = New DataGridCell(hti.Row, hti.Column)
DataGrid2.Select(hti.Row)
Splash.Global.indvid = DataGrid2.Item(hti.Row, 1) 'Column 3
Dim individ
individ = DataGrid2.Item(hti.Row, 1) 'Column 3
Dim cnn, rst, fieldValue
cnn = CreateObject("ADODB.Connection")
rst = CreateObject("ADODB.Recordset")
cnn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Splash\Splash.mdb;")
rst.Open("select lngmemberid from tblmember where lngid = " & individ & "", cnn, 3)
' Read table rows until the end
Do Until rst.eof
Splash.Global.memberid = rst.Fields("lngmemberid").Value
rst.MoveNext()
Loop
End If
Dim frmMain As New frmMain
Dim myParent = Me.MdiParent
'replace Form1 with type of the MDI form
With frmMain
.MdiParent = myParent
Me.Close()
.Show()
End With
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label4.Text = FormatDateTime(Now, DateFormat.LongDate)
Label3.Text = TimeOfDay
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim frmMain As New frmlessons
Dim myParent = Me.MdiParent
'replace Form1 with type of the MDI form
With frmMain
.MdiParent = myParent
' Me.Close()
.Show()
End With
End Sub
Private Sub DataGrid1_Navigate(ByVal sender As System.Object, ByVal ne As System.Windows.Forms.NavigateEventArgs) Handles DataGrid1.Navigate
End Sub
End Class
ASKER
Thank, but that wasn't it. I'm still getting the error.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
I'm not sure, but suspect that the problem might be due to the line "DataGrid1.Select(hti.Row)
Also, I strongly suggest that you begin using "Option Explicit" and "Option Strict" in your code. It will benefit you greatly.
Cheers,
Randy