Solved

adding data to a DGV

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now