<docbook><section><title>VirtIngresVisualStudioDataGridFormsApp</title><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3">Visual Studio Windows DataGrid Form Application</bridgehead>
<para>This article details the steps required to create a simple Visual Studio 2008 Windows Form application, with associated DataGridView control for displaying data in selected tables from the target database.</para>
<orderedlist spacing="compact"><listitem>Launch the Visual Studio 2008 SP1 IDE.
<figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtDataGridApp01.png" /></figure> </listitem>
<listitem>Create a <emphasis>Web Application</emphasis> project by going to the <emphasis>File</emphasis> menu in Visual Studio and choosing <emphasis>New Project</emphasis>.
  </listitem>
<listitem>When the New Project window appears, choose either <emphasis>Visual Basic</emphasis> or <emphasis>Visual C#</emphasis> as your programming language. </listitem>
<listitem>Within the language category click on <emphasis>Windows</emphasis> and select <emphasis>Windows Form Application</emphasis> from the right-hand panel.
  </listitem>
<listitem>Choose a name for the project, for example <emphasis>VirtWindowsFormApplication</emphasis>, and click <emphasis>OK</emphasis>.
<figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtDataGridApp02.png" /></figure> </listitem>
<listitem>In the <emphasis>Toolbox</emphasis>, expand <emphasis>Data</emphasis> Controls and drag the <emphasis>DataGridView</emphasis> control onto the form.
<figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtDataGridApp03.png" /></figure> </listitem>
<listitem>Click on the little <emphasis>arrow</emphasis> on the top right of the <emphasis>DataGridView</emphasis> control to load the <emphasis>DataGridView Task</emphasis> menu.
<figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtDataGridApp04.png" /></figure> </listitem>
<listitem>Click on the <emphasis>Choose Data Source</emphasis> list box.
<figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtDataGridApp05.png" /></figure> </listitem>
<listitem>Click on the <emphasis>Add Project Data Source</emphasis> link to connect to a data source.
<figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtDataGridApp06.png" /></figure> </listitem>
<listitem>In the <emphasis>Data Source Configuration Wizard</emphasis> dialog <emphasis>Choose Data Source Type</emphasis> page, select the <emphasis>Database</emphasis> data source type and click <emphasis>Next</emphasis>.
<figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtDataGridApp07.png" /></figure> </listitem>
<listitem>In the <emphasis>Data Source Configuration Wizard</emphasis> dialog <emphasis>Choose your Data Connection</emphasis> page, select the <emphasis>New Connection</emphasis> button.
<figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtDataGridApp08.png" /></figure> </listitem>
<listitem>In the <emphasis>Choose Data Source</emphasis> dialog, select the <emphasis>OpenLink Virtuoso Data Source</emphasis> from the list and click <emphasis>Continue</emphasis>.
<figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtDataGridApp10.png" /></figure> </listitem>
<listitem>In the <emphasis>Add Connection</emphasis> dialog, specify the <emphasis>hostname</emphasis>, <emphasis>portno</emphasis>, <emphasis>username</emphasis>, and <emphasis>password</emphasis> for the target Virtuoso Server and and check the <emphasis>Save Password</emphasis> check box.
<figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtAdoNetAddConn.png" /></figure> </listitem>
<listitem>Select the <emphasis>Select Database From List</emphasis> radio button and choose the <emphasis>TUT</emphasis> database from the drop down list.
<figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtIngresEDM4.png" /></figure> </listitem>
<listitem>Press the <emphasis>Test Connection</emphasis> dialog to verify the database is accessible.
<figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtEDM5.png" /></figure> </listitem>
<listitem>Click <emphasis>OK</emphasis> to add the connection. <figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtIngresEDM5_1.png" /></figure> </listitem>
<listitem>Leave the name of the connect string to the default of <emphasis>TUTConnectionString</emphasis> and click <emphasis>Next</emphasis>.
<figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtIngDataGridApp13.png" /></figure> </listitem>
<listitem>From the list of available tables returned for the TUT database, select the <emphasis>cust_orders</emphasis> table to be associated with the <emphasis>DataGridView</emphasis> control.
<figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtIngDataGridApp14.png" /></figure> </listitem>
<listitem>The column names of the select table will be displayed in the the DataGridView.
<figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtIngDataGridApp15.png" /></figure> </listitem>
<listitem>Resize the Form and DataGridView to allow all columns to be visible if possible.
<figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtIngDataGridApp17.png" /></figure> </listitem>
<listitem>To test the application, simply hit <emphasis>Ctrl+F5</emphasis> within Visual Studio or select  <emphasis>Start Debugging</emphasis> from the <emphasis>Debug</emphasis> menu.
<figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtDataGridApp16.png" /></figure> </listitem>
<listitem>The data from the <emphasis>cust_orders</emphasis> table will be displayed in the <emphasis>DataGrid</emphasis>.
<figure><graphic fileref="VirtIngresVisualStudioDataGridFormsApp/VirtIngDataGridApp18.png" /></figure></listitem>
</orderedlist><para>The task is now complete.
</para>
</section></docbook>