G
Graham Blandford
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...DataBindings 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_client_trans
.SelectCommand.Parameters("nman_path").Value = str_nman_path
.Fill(dsLinkMAN)
End With
' if empty then add
If dsLinkMAN.Tables("client_trans").Rows.Count = 0 Then
Dim dr_client_trans As DataRow
dr_client_trans = dsLinkMAN.Tables("client_trans").NewRow
With dr_client_trans
.Item("nman_path") = str_nman_path
.Item("description") = "New database"
.Item("summit_client_id") = ""
dsLinkMAN.Tables("client_trans").Rows.Add(dr_client_trans)
End With
End If
' open client form
Dim frm As New frmClient(daLinkMAN_client_trans, dsLinkMAN, cnLinkMAN)
' frm.MdiParent = Me
frm.ShowDialog()
Debug.WriteLine(dsLinkMAN.HasChanges)
Debug.WriteLine(dsLinkMAN.HasErrors)
daLinkMAN_client_trans.Update(dsLinkMAN.Tables("client_trans"))
dsLinkMAN.Tables("client_trans").Clear()
In the Child form I have...
txtpath.DataBindings.Add(New Binding("Text", ds_client_trans,
"client_trans.nman_path"))
txtdescription.DataBindings.Add(New Binding("Text", ds_client_trans,
"client_trans.description"))
txtclient.DataBindings.Add(New Binding("Text", ds_client_trans,
"client_trans.summit_client_id"))
DataGrid1.DataSource = 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...DataBindings 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_client_trans
.SelectCommand.Parameters("nman_path").Value = str_nman_path
.Fill(dsLinkMAN)
End With
' if empty then add
If dsLinkMAN.Tables("client_trans").Rows.Count = 0 Then
Dim dr_client_trans As DataRow
dr_client_trans = dsLinkMAN.Tables("client_trans").NewRow
With dr_client_trans
.Item("nman_path") = str_nman_path
.Item("description") = "New database"
.Item("summit_client_id") = ""
dsLinkMAN.Tables("client_trans").Rows.Add(dr_client_trans)
End With
End If
' open client form
Dim frm As New frmClient(daLinkMAN_client_trans, dsLinkMAN, cnLinkMAN)
' frm.MdiParent = Me
frm.ShowDialog()
Debug.WriteLine(dsLinkMAN.HasChanges)
Debug.WriteLine(dsLinkMAN.HasErrors)
daLinkMAN_client_trans.Update(dsLinkMAN.Tables("client_trans"))
dsLinkMAN.Tables("client_trans").Clear()
In the Child form I have...
txtpath.DataBindings.Add(New Binding("Text", ds_client_trans,
"client_trans.nman_path"))
txtdescription.DataBindings.Add(New Binding("Text", ds_client_trans,
"client_trans.description"))
txtclient.DataBindings.Add(New Binding("Text", ds_client_trans,
"client_trans.summit_client_id"))
DataGrid1.DataSource = ds_client_trans.Tables("client_trans")
If anyone could shed any light on this I'd be most grateful.
Thanks,
Graham