Solved

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

Posted on 2007-04-10
1
736 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 125 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

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…

751 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