Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2008

Tip: Looking for answers? Try searching our database.

DataGridView calculated field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Aleksey Timonin - 23 Jan 2008 16:23 GMT
Hi guys,
I have a DataGridView binded to DataTable.
In the DataTable I have an "ID" field.
How can I create calculated column in the DataGridView that gets as value
object (string) from my list, where item index in the list is equal to value
in "ID" field?

Thanks a lot
Aleksey
RobinS - 27 Jan 2008 17:52 GMT
So you have an ID field, and in the background you have a list with all the
items, and want to show the value that goes with the ID?

You could use a DataGridViewComboBoxColumn and bind it.

You could also use the Format and Parse events on the cells of the
datagridview. Check the column index, and if it's the right column, in the
Format event you would get the description and show it in the grid; in the
Parse event you would take the description and get the corresponding ID.

There's a great example of this in Brian Noyes's Data Binding Book.

RobinS.
---------------------------------------------
> Hi guys,
> I have a DataGridView binded to DataTable.
[quoted text clipped - 6 lines]
> Thanks a lot
> Aleksey

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.