View Single Post
  #1 (permalink)  
Old August 1st, 2007, 06:04 PM
cesarfranciso cesarfranciso is offline
Authorized User
 
Join Date: Jan 2007
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Option Strict On/passing a Datarow

Private Sub Table1DataGridView_CellMouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArg s) Handles Table1DataGridView.CellMouseDoubleClick

 If Table1DataGridView.CurrentRow.DataBoundItem Is Nothing Then
        Me.Table1TableAdapter.Fill(Me.NewAppDBDataSet.Tabl e1)
 Else
        Me.TabControl1.SelectedTab = TabPage1
        txtboxID.Text = CType(Table1DataGridView.CurrentRow.DataBoundItem( "ID"), Integer)
        Table1TableAdapter.FillByID(NewAppDBDataSet.Table1 , CType(txtboxID.Text, Integer))
 End If
End Sub
-----------------------------------------------------------------------------------------------------
I am trying to pass data from DataGridView (Tab2) to a Data Entry Form (Tab1).
The row's column are: ID (the Key), First Name,
Last Name, DOB, Phone1, Phone2
If I have Option Strict On, this line: >
CType(Table1DataGridView.CurrentRow.DataBoundItem( "ID") will
cause exception saying, Option Strict On disallows late binding.
Do I have to worry about this or just let it go?
Is there an other solution to this problem?

The same problem occurs when trying to pass the key from one Form to another:

Private Sub Table2DataGridView_CellMouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArg s) Handles Table2DataGridView.CellMouseDoubleClick
        entryform.Show()
        Dim i As Integer
        i = CType(Table2DataGridView.CurrentRow.DataBoundItem( "ID"), Integer)
        entryform.TextBox9.Text = i.ToString
        entryform.Table2TableAdapter.FillByCloth(entryform .HOEXDBDataSet.Table2, CType(entryform.TextBox9.Text, Integer))
        entryform.ToolStripStatusLabel1.Text = " Record is ready to modify"
        HOEX.HClothingForm.Close()
        Me.Close()
End Sub