Solved

adding data to a DGV

Posted on 2014-02-20
1
250 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
[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 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

630 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