Arg81
Well-known member
Kulrom tried helping with this a while back, but between us it remained an unsolved mystery. I've decided to resurrect it to see whether anyone else has had the problem, or whether anyone knows the answer.
Here's the scenario:
When a user selects a row in a datagrid, and presses "Info", currency manager opens the information about that row displayed as a form. This was taken from MS ADO.Net book by David Sceppa.
Here is the code for the button:
Here is the the RevAdd code on the form:
[/color][/size]
Heres the problem:
txtResponseDoc is a link label. The user presses another button, and an OpenFileDialog appears. The user selects the file they want (only one file) and when they click OK, the string of the file location is stored in the link label. I.E. \\Server1\Downloads\VBNet\solution.doc
The link label then has the ability to click and go to that file.
The code for the button is:
This works fine.
HOWEVER....As soon as the user clicks Update on the form, and this runs showDialog = DialogResult.OK and the form closes, all of the data appears in the datagrid appart from the documentation filename
Now for the weird bit....If I replace the linkLabel with a textBox, and type anything in there, it is updated to the datagrid.
Obviously this means that the problem is with the OFD. I've tried changing the way the form is to;
If Me.ShowDialog = DialogResult.Yes
In case it was because the two DialogResult.OK 's were conflicting. This still didn't work.
Other than passing this across to Microsoft themselves, does anyone have any ideas?
Regards,
Luke
Here's the scenario:
When a user selects a row in a datagrid, and presses "Info", currency manager opens the information about that row displayed as a form. This was taken from MS ADO.Net book by David Sceppa.
Here is the code for the button:
VB.NET:
[size=2][color=#0000ff]Dim[/color][/size][size=2] frm [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] frmAddResponse
frm.RevAdd(cmRevision)
frm.Dispose()
[/size]
Here is the the RevAdd code on the form:
VB.NET:
[size=2][color=#0000ff]Dim[/color][/size][size=2] dsDWR [/size][size=2][color=#0000ff]As[/color][/size][size=2] dsSearchDWR
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] drvDetail [/size][size=2][color=#0000ff]As[/color][/size][size=2] DataRowView
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] dvDetail [/size][size=2][color=#0000ff]As[/color][/size][size=2] DataView
[/size][size=2][color=#0000ff]Public[/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] RevAdd([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] cm [/size][size=2][color=#0000ff]As[/color][/size][size=2] CurrencyManager)
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]txtResponseHeader.Focus()
[/size][size=2][color=#008000]'open the form bound to the revision selected in the main form
[/color][/size][size=2][color=#0000ff]Me[/color][/size][size=2].BindingContext(dvDetail).Position = cm.Position
[/size][size=2]txtResponseHeader.DataBindings.Add("Text", dvDetail, "ResponseHeader")
txtResponse.DataBindings.Add("Text", dvDetail, "Response")
txtResponseDoc.DataBindings.Add("Text", dvDetail, "ResponseDocumentation")
[/size][size=2][color=#0000ff]If [/color][/size][size=2][color=#0000ff]Me[/color][/size][size=2].ShowDialog = DialogResult.OK [/size][size=2][color=#0000ff]Then
[/color][/size][size=2]cm.EndCurrentEdit()
[/size][size=2][color=#0000ff]Else
[/color][/size][size=2]cm.CancelCurrentEdit()
[/size][size=2][color=#0000ff]End [/color][/size][size=2][color=#0000ff]If
[/color][/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Sub[/color][/size]
[size=2][color=#0000ff]
Heres the problem:
txtResponseDoc is a link label. The user presses another button, and an OpenFileDialog appears. The user selects the file they want (only one file) and when they click OK, the string of the file location is stored in the link label. I.E. \\Server1\Downloads\VBNet\solution.doc
The link label then has the ability to click and go to that file.
The code for the button is:
VB.NET:
Dim x as new OpenFileDialog
[size=2][color=#0000ff]If[/color][/size][size=2] x.ShowDialog = DialogResult.OK [/size][size=2][color=#0000ff]Then
[/color][/size][size=2]txtResponseDoc.Text = x.FileName
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]If
[/color][/size]
This works fine.
HOWEVER....As soon as the user clicks Update on the form, and this runs showDialog = DialogResult.OK and the form closes, all of the data appears in the datagrid appart from the documentation filename
Now for the weird bit....If I replace the linkLabel with a textBox, and type anything in there, it is updated to the datagrid.
Obviously this means that the problem is with the OFD. I've tried changing the way the form is to;
If Me.ShowDialog = DialogResult.Yes
In case it was because the two DialogResult.OK 's were conflicting. This still didn't work.
Other than passing this across to Microsoft themselves, does anyone have any ideas?
Regards,
Luke