Click here to Skip to main content
15,849,996 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Does any one know how to display this on a form in a dataviewgrid I can do it in an console app but I want to dot it in a form

namespace ConsoleApplication1
    class Program
        static void Main(string[] args)
              // Retrieve the enumerator instance and then the data.
    SqlDataSourceEnumerator instance =
    System.Data.DataTable table = instance.GetDataSources();

    // Display the contents of the table.

    Console.WriteLine("Press any key to continue.");

  private static void DisplayData(System.Data.DataTable table)
    foreach (System.Data.DataRow row in table.Rows)
      foreach (System.Data.DataColumn col in table.Columns)
        Console.WriteLine("{0} = {1}", col.ColumnName, row[col]);
Updated 24-Aug-12 11:01am
[no name] 24-Aug-12 7:11am    
It would be easier to create a forms application and copy your code to it rather than try and explain to you how to change your console application to a forms application.

1 solution

You just put a gridview or similar on your form, set it's datasource property and call databind()
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900