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

  • SEARCH
  • Home
  • 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 8412787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:45:54+00:00 2026-06-10T00:45:54+00:00

I encountered a problem whereby the data grid view column does not show more

  • 0

I encountered a problem whereby the data grid view column does not show more then 1 values if the values falls under the same category.

Example: 2 people working under the same place. First guy shift timing is : 10:00 – 1700. Second guy shift timing is : 1500: 2100.

I implement codes to show the 2 guys’ shift timing in the Schedule data grid view. The problem starts here. This 2 workers have overlapping time shift between 15:00 – 17:00. The values shown in the data grid view between 15:00 – 17:00 is only the First guy’s name. I need to show both employee names during the time shift, 15:00 – 17:00.

This is the code to show the data into the data grid view.

foreach (allocation a in query)
        {
            for (int i = 0; i < scheduleDGV.Rows.Count - 1; i++)
            {
                for (int j = 0; j < scheduleDGV.Columns.Count; j++)
                {
                    if (cbLocation.SelectedItem.Equals(a.LocationName) && cbScheduleDate.SelectedItem.Equals(a.AllocationDate))
                    {
                        if (a.LocationName.Equals(scheduleDGV["Location", i].Value.ToString()) &&
                            a.StationName.Equals(scheduleDGV["Station", i].Value.ToString()))
                        {
                            if (scheduleDGV.Columns[j].HeaderText.Equals(a.AllocationTime.ToString()))
                            {
                                scheduleDGV[j, i].Value = a.EmployeeName;
                            }
                        }
                    }
                }
            }
        }

Anyone out there has any ideas of how to implement it such that it could show both names instead of one only? Thanks! Help will be greatly appreciated. 🙂

  • 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-06-10T00:45:55+00:00Added an answer on June 10, 2026 at 12:45 am

    Your problem probably arises from the line

    scheduleDGV[j, i].Value = a.EmployeeName; 
    

    where you’re just putting the relevant employee name in the cell, not checking whether there’s already a name there.

    Without refactoring the rest of your code, you could replace this line with:

    var existingName = scheduleDGV[j, i].Value as string;
    if (!String.IsNullOrempty(existingName))
    {
        scheduleDGV[j, i].Value = 
            existingName +
            Environment.NewLine +
            a.EmployeeName;
    }
    else
    {
        scheduleDGV[j, i].Value = a.EmployeeName; 
    }
    

    and see if that does what you expect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi i encountered this problem whereby when i initialized my String[], there seems to
I have encountered a problem twice now whereby a producer thread produces N work
I encountered a problem after having more than one texture in my engine. My
I have encountered this problem a few times, and am not able to figure
I've encountered a problem where a small number of data objects stored using a
Encountered a problem on posting comment back to a comment box. post not showing
Problem Encountered At runtime, I always get the following NHibernate.MappingException : Could not compile
I encountered a problem where when the user select the id from the data
i encountered a problem using the apache commons-net telnet api, and hope you can
I encountered a problem when I tried to use java from matlab. I read

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.