Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7490003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:28:16+00:00 2026-05-29T15:28:16+00:00

I am making a gantt chart programatically. What I do is get the project’s

  • 0

I am making a gantt chart programatically. What I do is get the project’s tasks bind it to the gridview, and then get the project duration in days, loop over it to add 1 additional column per day on the grid view. What I need to do is get the duration of each task, and then fill the corresponding cells in the grid.

i.e.
Project duration – 5 days.
task 1 duration – 2 days > needed: fiil 2/5 of dgv cells.

Is this possible?

EDIT

//GET PROJECT TASK
string GetTasks = "SELECT TaskName FROM CreateTask WHERE ProjectID='" + ProjectID_Txt.Text + "'";
DataTable ProjTasks_DT = new DataTable();
SqlDataAdapter ProjTasks_Adapter;

ProjTasks_Adapter = new SqlDataAdapter(GetTasks, connString);
ProjTasks_DT.Clear();
ProjTasks_Adapter.Fill(ProjTasks_DT);
connString.Close();

TaskTrackingGrd.DataSource = ProjTasks_DT;

//PROJECT DURATION IN HOURS
int DayDuration = ((Project_EndDate.Value - Project_StartDate.Value).Days) + 1;

//ADDS THE COLUMNS
for (int i = 0; i < DayDuration; i++) 
{
    var col3 = new DataGridViewTextBoxColumn();
    col3.HeaderText = "Day " + (i+1);
    TaskTrackingGrd.Columns.AddRange(new DataGridViewColumn[] { col3 });
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T15:28:18+00:00Added an answer on May 29, 2026 at 3:28 pm

    Yes:

    int col, row;
    Color color;
    ...
    dgv[col, row].Style.BackColor = color;
    

    Suppose the task is row 1 and the project begins on day 2 and runs for 3 days:

    {    
        ShowTask(1, 2, 3, Color.Red);
    }
    
    void ShowTask(int taskRow, int startDay, int duration, Color color)
    {
        for (int day = startDay - 1; day < startDay + duration - 1; day++)
            dgv[day, taskRow].Style.BackColor = color;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Making an uno game for a project. all 108 cards are located in a
I've worked on a few projects managed through the use of a Gantt chart.
making an infinite loop in javascript, and jQuery... this is my current code: $(#bg2).css({opacity:
When making a call to jQuery get , how does one specify HTML elements
I making a web app in Flex using global coordinates I get the coordinates
Making project through command line behaves as expected and provides neat and colored output:
Making project through command line behaves as expected and provides neat and colored output:
Making a GET request is easy, you just specify an URL in the href
Making echo of a question around the web: Is the syntax for svn:ignore patterns
Making my first steps with NHibernate, I'm trying to have it creating my Tables

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.