Solved

Can't get value using datagridview.CurrentRow.Cells("Column Name").Value - Column name not found

Posted on 2009-06-28
2
681 Views
Last Modified: 2012-05-07
I have been beating my head against the wall for the last hour looking at various postings that seem to replicate exactly what I have below.

When I look at my datagridview, I can see the specific column headings names....one of which is 'Address'.  Yet when I run this line of code below, it tells me Column named Address can not be found.  Because the columns can be re-arranged I can't use the column index.  I HAVE TO USE THE COLUMN NAME.  What's wrong with this?
 
vals(i) = grdviewTable.CurrentRow.Cells("Address").Value
0
Comment
Question by:TSFLLC
2 Comments
 
LVL 48

Accepted Solution

by:
jpaulino earned 500 total points
ID: 24732343
The column name could be different from the column text. Check that.
0
 

Author Comment

by:TSFLLC
ID: 24732739
I just realized in looking at my code where I dynamically set up the grid fields that I am not updating the column name.

You're on the mark.  Thanks!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

808 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