Arg81
Well-known member
On my main form I have a link label and a browse button. When the browse button is clicked, an OFD comes up, allows the user to select a file, and copys this file to the link label. Then I have the process set so when the user clicks on the link label, it opens the document stored within it.
Here's my code:
Private Sub btnRDBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRDBrowse.Click
Dim xRD As New OpenFileDialog
With xRD
.InitialDirectory = "s:\"
.Title = "Browse for Response Documentation"
If .ShowDialog = DialogResult.OK Then
txtResponseDoc.Text = .FileName
End If
End With
End Sub
The above code works fine and when submitted to the DB, the location that is in the link label is sent to the field OK, e.g. s:\IT\test1.doc
I have a datagrid (read only) with child data that only displays a summary of ID, Name and Town. When the user clicks another button, it brings up a modal form with all of the information from the table, i.e. ID, Name, Add1, Add2, Town, City, etc
I have another OFD sub like above for another text field, and this works OK in the sense it copies the file to the textbox, and then the user can click and it opens OK etc.
But when updated, the text in this box is not sent back to the DB. However, if I manually type any text into this box and Update, the data is submitted back to the DB, thus proving that there are no errors with my data bindings.
This has now got me properly confused - is it something to do with the OFD not liking modal forms? Basically on the button that opens all the information on the modal form, it uses currencyManager to pull all of the information for that record selected in the dataGrid, and then on the form, when the user clicks Update or Cancel, it uses either cm.endcurrenctedit or cm.cancelcurrentedit.
I can only assume this is the problem - has anyone got any ideas, - maybe I have to use the OFD component instead of writing it at runtime?
Cheers guys, something for the weekend
Luke
Here's my code:
Private Sub btnRDBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRDBrowse.Click
Dim xRD As New OpenFileDialog
With xRD
.InitialDirectory = "s:\"
.Title = "Browse for Response Documentation"
If .ShowDialog = DialogResult.OK Then
txtResponseDoc.Text = .FileName
End If
End With
End Sub
The above code works fine and when submitted to the DB, the location that is in the link label is sent to the field OK, e.g. s:\IT\test1.doc
I have a datagrid (read only) with child data that only displays a summary of ID, Name and Town. When the user clicks another button, it brings up a modal form with all of the information from the table, i.e. ID, Name, Add1, Add2, Town, City, etc
I have another OFD sub like above for another text field, and this works OK in the sense it copies the file to the textbox, and then the user can click and it opens OK etc.
But when updated, the text in this box is not sent back to the DB. However, if I manually type any text into this box and Update, the data is submitted back to the DB, thus proving that there are no errors with my data bindings.
This has now got me properly confused - is it something to do with the OFD not liking modal forms? Basically on the button that opens all the information on the modal form, it uses currencyManager to pull all of the information for that record selected in the dataGrid, and then on the form, when the user clicks Update or Cancel, it uses either cm.endcurrenctedit or cm.cancelcurrentedit.
I can only assume this is the problem - has anyone got any ideas, - maybe I have to use the OFD component instead of writing it at runtime?
Cheers guys, something for the weekend
Luke