關於form2加載form1中datagridview中的數據的問題!解决思路

關於form2加載form1中datagridview中的數據的問題!
我的用意是form2加载form1中datagridview中的数据,利用form2修改数据源中的数据,贴上代码,老手帮我看看,
为什么form2总是显示datagridview中的第一行数据,我要的是显示当前点击的行的数据,谢谢了。。


VB.NET code

Imports System.Data
Imports System.Data.SqlClient

Public Class JBZL

    Inherits System.Windows.Forms.Form
    Friend objconnection As SqlConnection = New SqlConnection("server=DADI-20111226ZE;database=plan;user id=sa;password=123")
    Public objdataAdapter As New SqlDataAdapter
    Public objdataset As New DataSet()
    Private Sub JBZL_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        objdataAdapter.SelectCommand = New SqlCommand
        objdataAdapter.SelectCommand.Connection = objconnection
        objdataAdapter.SelectCommand.CommandText = "SELECT * FROM bom"

        objdataAdapter.SelectCommand.CommandType = CommandType.Text
        objconnection.Open()
        objdataAdapter.Fill(objdataset, "bom")
        objconnection.Close()

        DataGridView2.DataSource = objdataset
        DataGridView2.DataMember = "bom"



        objdataAdapter = Nothing
        objconnection = Nothing


    End Sub
    Private Sub DataGridView2_RowHeaderMouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView2.RowHeaderMouseDoubleClick
        If Me.DataGridView2.SelectedRows.Count > 0 Then

            JBZL_BOM.ShowDialog()

        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      
    End Sub
End Class




VB.NET code

Imports System.Data
Imports System.Data.SqlClient

Public Class JBZL_BOM
    Inherits System.Windows.Forms.Form
    Dim objconnection As SqlConnection = New SqlConnection("server=DADI-20111226ZE;database=plan;user id=sa;password=123")
    Dim objdataAdapter As SqlDataAdapter = New SqlDataAdapter("SELECT 組件料號,組件品名,生產區域,原料料號,原料品名,主分群說明 FROM bom", objconnection)
    Dim objdataset As DataSet = JBZL.objdataset
    Dim objdataview As DataView
    Dim objcurrencymanager As CurrencyManager
    Private Sub ToolStripButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton4.Click
        Me.Close()
    End Sub

    Private Sub JBZL_BOM_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        fillDatasetAndView()
        bindfields()

    End Sub
    Private Sub fillDatasetAndView()
        objdataset = New DataSet
        objdataAdapter.Fill(objdataset, "bom")
        objdataview = New DataView(objdataset.Tables("bom"))
        objcurrencymanager = CType(Me.BindingContext(objdataset), CurrencyManager)
    End Sub

    Private Sub bindfields()
        TextBox1.DataBindings.Clear()
        TextBox2.DataBindings.Clear()
        TextBox3.DataBindings.Clear()
        TextBox4.DataBindings.Clear()
        ComboBox1.DataBindings.Clear()
        TextBox6.DataBindings.Clear()


        TextBox1.DataBindings.Add("text", objdataview, "組件料號")
        TextBox2.DataBindings.Add("text", objdataview, "原料料號")
        TextBox3.DataBindings.Add("text", objdataview, "原料品名")
        TextBox4.DataBindings.Add("text", objdataview, "組件品名")
        TextBox6.DataBindings.Add("text", objdataview, "主分群說明")
        ComboBox1.DataBindings.Add("text", objdataview, "生產區域")

    End Sub

    Private Sub ComboBox1_DropDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.DropDown

    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

    End Sub
End Class