Click here to Skip to main content
16,005,491 members
Home / Discussions / C#
   

C#

 
AnswerRe: Easiest way to use menustrip as a tabcontrol Pin
Scott Dorman19-May-07 7:22
professionalScott Dorman19-May-07 7:22 
GeneralRe: Easiest way to use menustrip as a tabcontrol Pin
PIEBALDconsult19-May-07 11:19
mvePIEBALDconsult19-May-07 11:19 
GeneralRe: Easiest way to use menustrip as a tabcontrol Pin
Scott Dorman19-May-07 13:17
professionalScott Dorman19-May-07 13:17 
GeneralRe: Easiest way to use menustrip as a tabcontrol Pin
Husker4723-May-07 5:06
Husker4723-May-07 5:06 
QuestionExtracting email address from websites Pin
Jahedur Rahman Chowdhury19-May-07 6:29
Jahedur Rahman Chowdhury19-May-07 6:29 
AnswerRe: Extracting email address from websites Pin
Scott Dorman19-May-07 7:24
professionalScott Dorman19-May-07 7:24 
QuestionAdventures in Excel Pin
rahvyn619-May-07 6:27
rahvyn619-May-07 6:27 
AnswerRe: Adventures in Excel Pin
rahvyn619-May-07 9:20
rahvyn619-May-07 9:20 
Got a solution if anyone is interested:

In order to do this, you will need to call the GetFirstColumn method on
the Columns collection, as this method will take display order into account
(while the iterator will not). You need to follow that up with a call to
GetNextColumn using the previous column. This makes it perfect for an
iterator:

private static IEnumerable<datagridviewcolumn>GetDisplayOrderEnumeration(DataGridViewColumnCollection columns)
{
// Get the first column.
DataGridViewColumn column = columns.GetFirstColumn(DataGridViewElementStates.None);

// Continue while there is a column.
while (column != null)
{
// Yield the column.
yield return column;

// Get the next column.
column = columns.GetNextColumn(column,DataGridViewElementStates.None, DataGridViewElementStates.None);
}
}

The yield keyword will help create an IEnumerable implementation which
you can use a foreach statement to cycle though. You can use it to get the
name of the column to get the value of from the row:

for (int r = 0; r <= dgvMain.Rows.Count - 2; r++)
{
foreach (DataGridViewColumn c in GetDisplayOrderEnumeration(dgvMain.Columns))
{
value = dgvMain.Rows[r].Cells[c.Name].Value.ToString();
}
}

The method I gave you will give you an enumeration you can cycle through
to get the rows in the display order, which you can then use to access the
values in the same order in the underlying data source.

Thanks to Nicholas over at the msdn forums.
Questionhow to provide UPDATE PREFERENCES (daily./monthly./yearly) to our c# windows appliction Pin
pashitech19-May-07 2:28
pashitech19-May-07 2:28 
AnswerRe: how to provide UPDATE PREFERENCES (daily./monthly./yearly) to our c# windows appliction Pin
Scott Dorman19-May-07 4:57
professionalScott Dorman19-May-07 4:57 
QuestionHelp in replacing table of web in Windows application Pin
EEmaan19-May-07 2:10
EEmaan19-May-07 2:10 
AnswerRe: Help in replacing table of web in Windows application Pin
Vikram A Punathambekar19-May-07 8:11
Vikram A Punathambekar19-May-07 8:11 
Questionis it is possible to track the installation date ? Pin
pashitech19-May-07 0:19
pashitech19-May-07 0:19 
AnswerRe: is it is possible to track the installation date ? Pin
Scott Dorman19-May-07 5:01
professionalScott Dorman19-May-07 5:01 
Questionchat Pin
Rhydo19-May-07 0:09
Rhydo19-May-07 0:09 
AnswerRe: chat Pin
Christian Graus19-May-07 0:30
protectorChristian Graus19-May-07 0:30 
QuestionCombining Between a DataGridView and a TreeView Pin
OlaMohammed19-May-07 0:06
OlaMohammed19-May-07 0:06 
Questionclsdataclass Pin
Rhydo19-May-07 0:05
Rhydo19-May-07 0:05 
AnswerRe: clsdataclass Pin
Christian Graus19-May-07 0:33
protectorChristian Graus19-May-07 0:33 
QuestionHow can I access to a resource that is created in another thread? Pin
ali_reza_zareian18-May-07 23:46
ali_reza_zareian18-May-07 23:46 
AnswerRe: How can I access to a resource that is created in another thread? Pin
Dave Kreskowiak19-May-07 18:19
mveDave Kreskowiak19-May-07 18:19 
QuestionHow to kill exe ? Windows.NET Pin
NanaAM18-May-07 22:27
NanaAM18-May-07 22:27 
AnswerRe: How to kill exe ? Windows.NET Pin
Giorgi Dalakishvili18-May-07 23:09
mentorGiorgi Dalakishvili18-May-07 23:09 
GeneralRe: How to kill exe ? Windows.NET Pin
NanaAM19-May-07 2:01
NanaAM19-May-07 2:01 
GeneralRe: How to kill exe ? Windows.NET Pin
teejayem19-May-07 3:35
teejayem19-May-07 3:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.