Join us at IRC!
Ideas are far more powerful than guns.
Wednesday, May 23, 2012
Navigation
Members Online
Total Online: 23
Web Spiders: 15
Guests Online: 23
Members Online: 0

Registered Members: 70170
Newest Member: bahmx
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

C# is a pain

Lemur
Member



Posts: 644
Location:
Joined: 11.03.06
Rank:
HBH Guru
Posted on 07-11-09 04:52
I swear if this wasn't for a grade I would have trashed this...

Using a Data Grid View to add members for a Golf App. When I tried to read all members of a column into an array it bricked.

Source (Part)-
private void fullGameToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (string name in dgvPlayers.Columns["Names"])
{
}


Error-
foreach statement cannot operate on variables of type 'System.Windows.Forms.DataGridViewColumn' because 'System.Windows.Forms.DataGridViewColumn' does not contain a public definition for 'GetEnumerator'






Author

RE: C# is a pain

false
Member

Posts: 13
Location: (づの‿の)づ
Joined: 25.10.09
Rank:
Active User
Posted on 07-11-09 05:22
Lemur wrote:
I swear if this wasn't for a grade I would have trashed this...

Using a Data Grid View to add members for a Golf App. When I tried to read all members of a column into an array it bricked.

Source (Part)-
private void fullGameToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (string name in dgvPlayers.Columns["Names"])
{
}


Error-
foreach statement cannot operate on variables of type 'System.Windows.Forms.DataGridViewColumn' because 'System.Windows.Forms.DataGridViewColumn' does not contain a public definition for 'GetEnumerator'


I don't know much C#, but it looks like your error is occurring because you are trying to enumerate an object that doesn't have an enumerator.

A quick look at MSDN says that .Columns[] returns a DataGridViewColumn object, which does not contain a collection of the cells. What you'll probably want to do is enumerate through the .Rows collection instead.

More info: http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewrow.aspx


curl -s http://www.hellboundhackers.org/ | sed -n '29s/^<div[^>]*>\(.*\)<\/div>$/\1/p'
Guest
Username

Password

Remember Me


Bookmark This Page
Affiliates
Adverts

 

 

Links
By using, viewing or obtaining any information contained on this site, you agree to the disclaimer.

© HellBound Hackers 2008- 2009. Since 3rd December 2004.