Solved

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

Posted on 2009-06-28
2
685 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
[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
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

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