Click here to Skip to main content
16,011,120 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am working on the windows app that calculate critical path i am just a beginner Programmer. my program need to import excel file and convert it to 2 datagridview and then i was unable to write the algorithm that calculate them andy one can help me ? here is my code

C#
private List<int> Duration_Values = new List<int>(); // T 
private int Duration; // T
private string Predecessor;  
private List<string> Predecessor_Values = new List<string>();
private string Proj_name; 
private List<string> Proj_name_Values = new List<string>(); 
private int Earlystart;
private List<int> EarlyStart_value = new List<int>();
private List<string> Predecessor_Number = new List<string>();
private int FindES;
private List<int> FindES_Value = new List<int>();

// this is all what i create to use this 

for (int X = 0; X <= dataGridView1.RowCount - 1; X++) 
{

    Proj_name = Convert.ToString(dataGridView1.Rows[X].Cells[0].Value);

    Proj_name_Values.Add(Convert.ToString(Proj_name));
}
for (int X = 0; X <= dataGridView1.RowCount - 1; X++) 
{

    Duration = Convert.ToInt32(dataGridView1.Rows[X].Cells[1].Value);

    Duration_Values.Add(Convert.ToInt32(Duration));
}

for (int X = 0; X <= dataGridView1.RowCount - 1; X++) 
{

    Predecessor = Convert.ToString(dataGridView1.Rows[X].Cells[2].Value);

    String[] Word = Predecessor.Split(' ');

    Predecessor_Number.Add(Convert.ToString(Word.Length));

    Predecessor_Values.Add(Convert.ToString(Predecessor));
}



and this for looking up for the predecessor i can just set Earlystart if there isn't need any predecessor

C#
for (int i = 0; i < Proj_name_Values.Count - 1; i++)
{
    if (Predecessor_Number[i] == "1")
    {
        if (Predecessor_Values[i] == "-")
        {
            Earlystart = 0;
            EarlyStart_value.Add(Convert.ToInt32(Earlystart));

        }
}


i have no clue in doing this anyone can help me ? Please T^T
PS: Sorry if i suck at English
Posted
Updated 27-Jan-14 1:58am
v4
Comments
Richard MacCutchan 27-Jan-14 7:59am    
It's difficult to know what your actual problem is, but I suggest you use Google to find articles on CPM. You may be lucky and find some in your own language that will help you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900