Hi all,
I'm sure I must be missing something here.. I've created a simple parent -
child form appl. in which I open a dataset in the parent (MDI) using a
dataadaptor to an Access database, and a dataset.
The SELECT of the record set searches for a specific entry, if it returns a
0 rowcount, I go throiugh the motions of adding a row, and opening the child
form.. if it is found I just open the child form..
I am passing the dataset through the constuctor to my child form, and if I
use a datagrid to change the data, it marks the HasChanges correctly.
But, as i am only dealing with one row here, and I would like to use text
boxes for each column, I have tried to bind these in code - taken from the
..NET library...DataB indings entry...
The problem is, if I change the data in a text box, (incidentally, if I
leave the datagrid on the form, the cell appears to update for the changed
text), the HasChanges flag is not being set to True. Is there something I
need to code that will cause this to happen?
Here's a snippet of the code...
Parent form:
With daLinkMAN_clien t_trans
.SelectCommand. Parameters("nma n_path").Value = str_nman_path
.Fill(dsLinkMAN )
End With
' if empty then add
If dsLinkMAN.Table s("client_trans ").Rows.Cou nt = 0 Then
Dim dr_client_trans As DataRow
dr_client_trans = dsLinkMAN.Table s("client_trans ").NewRow
With dr_client_trans
.Item("nman_pat h") = str_nman_path
.Item("descript ion") = "New database"
.Item("summit_c lient_id") = ""
dsLinkMAN.Table s("client_trans ").Rows.Add(dr_ client_trans)
End With
End If
' open client form
Dim frm As New frmClient(daLin kMAN_client_tra ns, dsLinkMAN, cnLinkMAN)
' frm.MdiParent = Me
frm.ShowDialog( )
Debug.WriteLine (dsLinkMAN.HasC hanges)
Debug.WriteLine (dsLinkMAN.HasE rrors)
daLinkMAN_clien t_trans.Update( dsLinkMAN.Table s("client_trans "))
dsLinkMAN.Table s("client_trans ").Clear()
In the Child form I have...
txtpath.DataBin dings.Add(New Binding("Text", ds_client_trans ,
"client_trans.n man_path"))
txtdescription. DataBindings.Ad d(New Binding("Text", ds_client_trans ,
"client_trans.d escription"))
txtclient.DataB indings.Add(New Binding("Text", ds_client_trans ,
"client_trans.s ummit_client_id "))
DataGrid1.DataS ource = ds_client_trans .Tables("client _trans")
If anyone could shed any light on this I'd be most grateful.
Thanks,
Graham
I'm sure I must be missing something here.. I've created a simple parent -
child form appl. in which I open a dataset in the parent (MDI) using a
dataadaptor to an Access database, and a dataset.
The SELECT of the record set searches for a specific entry, if it returns a
0 rowcount, I go throiugh the motions of adding a row, and opening the child
form.. if it is found I just open the child form..
I am passing the dataset through the constuctor to my child form, and if I
use a datagrid to change the data, it marks the HasChanges correctly.
But, as i am only dealing with one row here, and I would like to use text
boxes for each column, I have tried to bind these in code - taken from the
..NET library...DataB indings entry...
The problem is, if I change the data in a text box, (incidentally, if I
leave the datagrid on the form, the cell appears to update for the changed
text), the HasChanges flag is not being set to True. Is there something I
need to code that will cause this to happen?
Here's a snippet of the code...
Parent form:
With daLinkMAN_clien t_trans
.SelectCommand. Parameters("nma n_path").Value = str_nman_path
.Fill(dsLinkMAN )
End With
' if empty then add
If dsLinkMAN.Table s("client_trans ").Rows.Cou nt = 0 Then
Dim dr_client_trans As DataRow
dr_client_trans = dsLinkMAN.Table s("client_trans ").NewRow
With dr_client_trans
.Item("nman_pat h") = str_nman_path
.Item("descript ion") = "New database"
.Item("summit_c lient_id") = ""
dsLinkMAN.Table s("client_trans ").Rows.Add(dr_ client_trans)
End With
End If
' open client form
Dim frm As New frmClient(daLin kMAN_client_tra ns, dsLinkMAN, cnLinkMAN)
' frm.MdiParent = Me
frm.ShowDialog( )
Debug.WriteLine (dsLinkMAN.HasC hanges)
Debug.WriteLine (dsLinkMAN.HasE rrors)
daLinkMAN_clien t_trans.Update( dsLinkMAN.Table s("client_trans "))
dsLinkMAN.Table s("client_trans ").Clear()
In the Child form I have...
txtpath.DataBin dings.Add(New Binding("Text", ds_client_trans ,
"client_trans.n man_path"))
txtdescription. DataBindings.Ad d(New Binding("Text", ds_client_trans ,
"client_trans.d escription"))
txtclient.DataB indings.Add(New Binding("Text", ds_client_trans ,
"client_trans.s ummit_client_id "))
DataGrid1.DataS ource = ds_client_trans .Tables("client _trans")
If anyone could shed any light on this I'd be most grateful.
Thanks,
Graham
Comment