Solved

Cell/Column Index for DataGridView versus DataTable?

Posted on 2014-11-26
7
99 Views
Last Modified: 2014-11-26
For a DataGridView AND DataTable...does the column index always start with zero?
0
Comment
Question by:BlakeMcKenna
  • 5
  • 2
7 Comments
 
LVL 39

Accepted Solution

by:
Kyle Abrahams earned 500 total points
Comment Utility
Yes it does . . . BUT note that they don't necessarily match (EG: sorting).
0
 

Author Closing Comment

by:BlakeMcKenna
Comment Utility
I thought so...just wanted to be sure!

Thanks Kyle
0
 

Author Comment

by:BlakeMcKenna
Comment Utility
Kyle,

I did notice one thing in my DGV. I have several cells that are Invisible and noticed that it affects the column index.

For example, my dgv has 10 columns (0 - 9 index). Column 0 - 3 are Invisible. The initial value in column 11 is 73.6. After the dgv is setup (making columns 0 - 3 invisible), the value 73.6 is not in column 7.

Is there a way to maintain values and column indexes even though certain dgv columns are invisible?
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:BlakeMcKenna
Comment Utility
The reason I ask is because my CellFormatting Even references the "e.ColumnIndex". This is where the column indexes are different.
0
 
LVL 39

Expert Comment

by:Kyle Abrahams
Comment Utility
There's something else going on there . . .   you can set the visible property on the indexed column itself:
http://msdn.microsoft.com/en-us/library/bb383893%28v=vs.90%29.aspx

Do you have auto generate columns set to false?
0
 

Author Comment

by:BlakeMcKenna
Comment Utility
AutoGenerateColumns isn't set, which I assume defaults to False...
0
 

Author Comment

by:BlakeMcKenna
Comment Utility
I actually execute a procedure that defines the DGV.DataPropertyName (which is the same as the DataTable Column Names) and HeaderText...
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

14 Experts available now in Live!

Get 1:1 Help Now