Arg81
Well-known member
Problem is simple.
User inputs data into master table with 1 dataEntry form.
Second user opens record, which has different form, showing data from the master table, and a dataGrid representing the child data.
When user clicks into dataGrid to add new record, all is OK. However, I do not want all fields showing in dataGrid and have used Currency Manager to open a form at the currently selected record in the dataGrid.
When user clicks "Add Record" and form is opened, error message "tableID does not allow nulls".
If there is a record in the dataGrid already, then the form opens OK - PROBLEM ONLY EXISTS WHEN THE FIRST ROW IS ADDED TO THE DATAGRID.
I use the following code:
[/color][/size]
And on the Form that opens at the position of the dataGrid:
My problem is obviously something to do with using Currency Manager (cm.AddNew) to create the first record in the table.
Has any body got any ideas, or a better solution for what I am trying to solve?
Thanks in advance
Luke
[/size]
User inputs data into master table with 1 dataEntry form.
Second user opens record, which has different form, showing data from the master table, and a dataGrid representing the child data.
When user clicks into dataGrid to add new record, all is OK. However, I do not want all fields showing in dataGrid and have used Currency Manager to open a form at the currently selected record in the dataGrid.
When user clicks "Add Record" and form is opened, error message "tableID does not allow nulls".
If there is a record in the dataGrid already, then the form opens OK - PROBLEM ONLY EXISTS WHEN THE FIRST ROW IS ADDED TO THE DATAGRID.
I use the following code:
VB.NET:
[size=2][color=#0000ff]Private[/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] btnAddRevision_Click([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] sender [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Object, [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.EventArgs) [/size][size=2][color=#0000ff]Handles[/color][/size][size=2] btnAddRevision.Click
cmRevision.AddNew()
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] frmAdd [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] frmRevisionAdd
frmAdd.RevAdd(cmRevision)
frmAdd.Dispose()
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Sub[/color][/size]
[size=2][color=#0000ff]
And on the Form that opens at the position of the dataGrid:
VB.NET:
[/color][/color][/size]
[size=2][color=#0000ff][color=#000000][/color][/color][/size]
[size=2][color=#0000ff][size=2][color=#0000ff]Public[/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2][color=#000000] RevAdd([/color][/size][size=2][color=#0000ff]ByVal[/color][/size][size=2][color=#000000] cm [/color][/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#000000] CurrencyManager)[/color]
drvDetail = [/size][size=2][color=#0000ff]CType[/color][/size][size=2](cm.Current, DataRowView)
dvDetail = drvDetail.DataView
dsDWR = [/size][size=2][color=#0000ff]CType[/color][/size][size=2](dvDetail.Table.DataSet, dsSearchDWR)
[/size][size=2][color=#008000]'open the form bound to the revision selected in the dataGrid
[/color][/size][size=2][color=#0000ff]Me[/color][/size][size=2].BindingContext(dvDetail).Position = cm.Position[/size]
[size=2]
My problem is obviously something to do with using Currency Manager (cm.AddNew) to create the first record in the table.
Has any body got any ideas, or a better solution for what I am trying to solve?
Thanks in advance
Luke
[/size]