Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Insert data into a Data Grid View using Visual Studio 2005/C#

Posted on 2007-04-10
1
Medium Priority
?
738 Views
Last Modified: 2013-11-26
I have a Windows program that I wrote in Visual Studio 2005 using C#.  It loops through a list of machine names and tries to contact them.  I would like to display the results in a grid format, but I can't figure out how to use a grid without a datasource.  I want a blank grid (except for headers), with a known number of columns that I can programmatically add rows to.  The data will not be retained when the program exits.  I've tried setting up a  Data Grid View with no data source and I can add columns in the designer, but I can't find a method that will allow me to create a new row.

0
Comment
Question by:nbtzlp3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 18884872
You can do a few things:

1) Create an in-memory DataTable to contain the data, and bind the DataGridView to the table.

2) Create an list of objects, using Generics, and bind the DataGridView to the list.

Bob
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question