I have a very simple Windows form application that uses a data set. I am having trouble figuring out how Visual Studio creates a new Table Adapter object and then initializes that object through its insertion of initialization code into the .Designer.vb files. My problem is I have inadvertently caused this to happen through some series of commands I do not remember, and am trying to figure out how to re-create what I did.
For example, if I want the data set to be used by a form, I know this goes in the form's Designer.vb module
Friend WithEvents StreetsTableAdapter1 As WindowsApplication1.DataSet1TableAdapters.streetsTableAdapter
However, this line alone won't instantiate the table adapter object.
As to the data set, I've created a one; configured one of its table's table adapters to use SQL queries; tested those queries; and they work.
I'm more interested in what Visual Studio writes to create the new object rather than the keystrokes to do it, because I'd like to know what's going on underneath the covers, rather than relying on keystroke magic.
I have a workaround
Me.StreetsTableAdapter1 = New DataSet1TableAdapters.streetsTableAdapter
I've added this to the form's .Designer.vb file. I'm still trying to figure out what I did in Visual Studio to get all this initialized through running some specific commands.
A pointer to an example would help, as well as the steps to make this happen. Then, I'll examine what Visual Studio does, so I do not get stuck again.
The easiest way to create the table adapter on your form is to let Visual Studio do it for you. In the toolbox "DataSources", you should see your current data. You can expand the nodes and drag the fields/tables to your form. This will create the table adapter and everything needed behind the scenes.