Skip to content

C# and DataGridView

William

Asked Mar 26, 2009, 12:36 PM EDT1 answer
Share
LinkedInX

I am currently teaching myself C# and Visual Studio 2005.  My questions have to do which populating the DataGridVeiw with data.  Here are my questions:

1.  Can I populate a DataGridView by reading information from a text file?  I am using text files to store my data because the data can and will change regularly based on calculations.  So far I have only seen examples that have binded data to a data base.  Should I be considering something other than the DataGridView?  However I need to have columns and rows.  I also need to be able to change the color of the text in each rows based on the calculations as well and I don't believe I can do this with a list box or list view, correct me if I am wrong.

2.  Should I use text files or should I create and separte source code files that contains a created array with the data in place that I use to populate the DataGridView? 

Your help is appreciated.

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Mahesh Chand
    0

    You can direct connection to a text file and fill data in a DataSet object. Here is an example:

    Connecting to a Text file using ADO.NET by Mike Gold on Aug 29, 2006
    A simple step by step tutorial shows you how to connect to a text file using ADO.NET and C#..
    0