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

x
?
Solved

adding data to a DGV

Posted on 2014-02-20
1
Medium Priority
?
251 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

688 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