If I use that button to call another form, and that other form has a datagrid that gets populated with a sql query, how to I get that information back into the field on the primary form?
Hell, how do I even CHOOSE the data?
I can click on a row.
Hmm, I assume I can create a button that asks the grid what is currently highlit.
On an ASP.NET form grid you can stick buttons into the grid, which is probably the simplest. If you do that, when the button is clicked, the event args object will indicate which rows button was clicked.
If you want to put a button under the grid, then you will need to look for a selected row or currently selected property for the grid object.
And then I have to communicate that back to the original text field.
I assume it is a scoping issue.
There are a lot of ways of doing that. The cleanest is probably to pass a reference to the object you want to update, and keep that in a form level variable. Either directly as part of the new form call or as a form level function that you call right after creating the form. That way your subform is not tied to the form it pops up over, you can use the same subform over multiple forms and updating different objects.
If the subform is specific to the main form, then putting a hard coded reference in may be acceptable. Something like App.Forms["FormID"].FindControl["TextBox"]. But I don't know .NET forms well enough to be sure about how to structure that of the top of my head.
Jay