Solved

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

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

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 …
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

803 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