Hi

i have created a master/detail one-to-one relation database form (.net framework 3.0) using two tables .

i have created programatically dataset , both table's TableAdapter, BindingSource , and also added relation between two tables in the dataset.

i want to bind master table to the datagrid and detail table's column with the textboxs (to use as one-to-one relation)

my problem is that when i add new row in master datagrid there is no automatically row added in child table, means in all textbox control which i already bind with the child relation table.

and when i use datagrid in child (detail) table it works great ! and perfectly.
when i add any record in master grid and then go to child grid the parent column automatically inherit its value to the child column , but this is not work with when i use child table in textbox controls..


so suggest any workaround ..

my coding is mention below.



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

m_dbPara.ConString = DatabaseConn.DataConnectionString

dataSetTemp.Clear()

scLib.Connection.OpenConn(m_dbPara.ConString, con)

dtAdpterMaster.SelectCommand = con.CreateCommand
dtAdpterMaster.SelectCommand.CommandText = "Select * from MasterTable"
dtAdpterMaster.Fill(dataSetTemp, "MasterTable")

dtAdpterDetail.SelectCommand = con.CreateCommand
dtAdpterDetail.SelectCommand.CommandText = "Select * from DetailTable"
dtAdpterDetail.Fill(dataSetTemp, "DetailTable")


dtRelation = New DataRelation("MasterDetail_Relation", dataSetTemp.Tables("MasterTable").Columns("ParentColumn"), dataSetTemp.Tables("DetailTable").Columns("ChildColumn"))

dataSetTemp.Relations.Add(dtRelation)

bindSrcMaster.DataSource = dataSetTemp
bindSrcMaster.DataMember = "MasterTable"

bindSrcDetail.DataSource = bindSrcMaster
bindSrcDetail.DataMember = "MasterDetail_Relation"


cmdBld_Master.DataAdapter = dtAdpterMaster
cmdBld_Detail.DataAdapter = dtAdpterDetail

DataGridMaster.DataSource = bindSrcMaster

texbox_Column1.DataBindings.Add("Text", bindSrcDetail, "Column1")
texbox_Column2.DataBindings.Add("Text", bindSrcDetail, "Column2")
texbox_Column3.DataBindings.Add("Text", bindSrcDetail, "Column3")
texbox_Column4.DataBindings.Add("Text", bindSrcDetail, "Column4")

End Sub
-------------------------------------------------