Solved

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

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now