Click here to Skip to main content
15,922,407 members
Home / Discussions / C#
   

C#

 
AnswerRe: Possible Overflow? Pin
Luc Pattyn17-Jun-07 14:25
sitebuilderLuc Pattyn17-Jun-07 14:25 
QuestionPictureBox contents lost when focus lost Pin
rbengali317-Jun-07 11:11
rbengali317-Jun-07 11:11 
AnswerRe: PictureBox contents lost when focus lost Pin
Luc Pattyn17-Jun-07 11:19
sitebuilderLuc Pattyn17-Jun-07 11:19 
AnswerRe: PictureBox contents lost when focus lost Pin
Christian Graus17-Jun-07 11:36
protectorChristian Graus17-Jun-07 11:36 
GeneralRe: PictureBox contents lost when focus lost Pin
rbengali317-Jun-07 17:32
rbengali317-Jun-07 17:32 
GeneralRe: PictureBox contents lost when focus lost Pin
Christian Graus17-Jun-07 20:13
protectorChristian Graus17-Jun-07 20:13 
AnswerRe: PictureBox contents lost when focus lost Pin
Hesham Yassin20-Jun-07 0:21
Hesham Yassin20-Jun-07 0:21 
QuestionGeneric Collection &Method Problem Pin
haz1317-Jun-07 10:40
haz1317-Jun-07 10:40 
I am really stuck trying work out and understand how to achieve the following. I have a collection of objects and want to peform some data analysis on each of the fields in turn using a method.

The collection
List<CardData> CardDataCollection = new List<CardData>();

CardData class contains fields called Card1,Card2,Card3 etc

The code below has been simplified to show what I'm currently doing for one of the collection object fields (CardDataCollection[i].Card1).

public static void CalcData()
{

    int i;

    for (i = 0; i < CardDataCollection.Count; i++)
    {
        if (CardDataCollection[i].Card1 == 1)
        {
            //do data processing here
        }
    }
}


I need to perform the same exercise on each of the Card fields (for Card1 upto Card100) in the collection so I want to create a method that will allow me pass in some kind of reference to the collection object field (CardX).

Note: I need access using the [i] as the data processing requires me to use for example [i-5] (i.e can't use foreach loops)

I know what I want it do but just can quite get my head around how to do it. I'll try to explian below how I would change the code.

public static void CalcData(reference to relevant card number field eg Card50)
{

    int i;

    for (i = 0; i < CardDataCollection.Count; i++)
    {
        if (Card50[i] == 1) //I know this can't be done
        {
            //do data processing here
        }
    }
}


Please excuse any incorrect technical description as I'm only new to this C#. Thanks in advance for any help you can give me.




Haz

AnswerRe: Generic Collection &Method Problem Pin
User 665817-Jun-07 10:51
User 665817-Jun-07 10:51 
QuestionRe: Generic Collection &Method Problem Pin
haz1317-Jun-07 11:48
haz1317-Jun-07 11:48 
AnswerRe: Generic Collection &Method Problem Pin
Christian Graus17-Jun-07 12:24
protectorChristian Graus17-Jun-07 12:24 
QuestionExport data to excel sheet Pin
HexaDeveloper17-Jun-07 9:32
HexaDeveloper17-Jun-07 9:32 
AnswerRe: Export data to excel sheet Pin
Jimmanuel18-Jun-07 3:48
Jimmanuel18-Jun-07 3:48 
GeneralRe: Export data to excel sheet Pin
HexaDeveloper21-Jun-07 2:17
HexaDeveloper21-Jun-07 2:17 
GeneralRe: Export data to excel sheet Pin
Jimmanuel21-Jun-07 2:23
Jimmanuel21-Jun-07 2:23 
QuestionComboBox change font on specific item.. Pin
akkram17-Jun-07 9:16
akkram17-Jun-07 9:16 
AnswerRe: ComboBox change font on specific item.. Pin
Dave Kreskowiak17-Jun-07 12:38
mveDave Kreskowiak17-Jun-07 12:38 
QuestionConnecting to FTP site Pin
frqftgbdafr17-Jun-07 9:01
frqftgbdafr17-Jun-07 9:01 
QuestionThe DateTime Value Type Pin
Brendan Vogt17-Jun-07 8:24
Brendan Vogt17-Jun-07 8:24 
AnswerRe: The DateTime Value Type Pin
Guffa17-Jun-07 8:54
Guffa17-Jun-07 8:54 
QuestionRe: The DateTime Value Type Pin
Brendan Vogt17-Jun-07 9:03
Brendan Vogt17-Jun-07 9:03 
AnswerRe: The DateTime Value Type Pin
User 665817-Jun-07 9:11
User 665817-Jun-07 9:11 
AnswerRe: The DateTime Value Type Pin
Luc Pattyn17-Jun-07 9:34
sitebuilderLuc Pattyn17-Jun-07 9:34 
GeneralRe: The DateTime Value Type Pin
PIEBALDconsult17-Jun-07 14:45
mvePIEBALDconsult17-Jun-07 14:45 
QuestionCreating list of method execution time Pin
AndrusM17-Jun-07 5:10
AndrusM17-Jun-07 5:10 

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.