Solved

adding data to a DGV

Posted on 2014-02-20
1
248 Views
Last Modified: 2014-02-20
hi - I have a datagridview that is linked to a datatable, where every column in the DGV is bound to a field in the datatable. I've added a column that I want to fill in programmatically, but the data isn't being displayed. I suspect it's because the rest of the DGV is data bound. how would I go about filling in the column with programmatically generated data? the couple lines below show where the data is coming from:

won't let me paste.
0
Comment
Question by:jdcoburn
1 Comment
 
LVL 24

Accepted Solution

by:
mankowitz earned 500 total points
ID: 39874198
you have to modify the underlying data structure before you bind the dgv to the datatable.

For example

DataTable dt = new DataTable("Customers");

workTable.Columns.Add("FirstName", typeof(String));
workTable.Columns.Add("LastName", typeof(String));
workTable.Columns.Add("FullName", typeof(String));

workTable.Columns["FullName"].Expression = "FirstName + LastName";

Open in new window

0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

789 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