title: How Does Visual Studio/VB Create and Initialize a Table Adapter?
body: <p>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.</p>
  
  <p>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 </p>
  
  <p><code>Friend WithEvents StreetsTableAdapter1 As WindowsApplication1.DataSet1TableAdapters.streetsTableAdapter</code></p>
  
  <p>However, this line alone won't instantiate the table adapter object. </p>
  
  <p>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. </p>
  
  <p>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.</p>
  
  <p>I have a workaround</p>
  
  <p><code>Me.StreetsTableAdapter1 = New DataSet1TableAdapters.streetsTableAdapter</code></p>
  
  <p>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.</p>
  
  <p>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.</p>