• 0

Bindingsource value getting reset


Question

Hi all,

 

This is my requirement: I have a datagridview which should be populated with employee shift data from shift details which is available in  sch.shift_detailsList(entity model-shift). For eg: shift for 1 week(nov 1 to nov 7) is saved in sch.shift_detailsList.So in the datagridview if the weekcount=2(ie shift to be saved for 2 weeks, ie cycledays=7*2 -1=13) , the bindingsource1(for the datagridview) should be populated with shift for 2 weeks, ie if start date given as nov1, then the shift details in sch.shift_detailsList should be repeated for the 2nd week also. So, when the loop finishes the 1st week and then i=7, and again it should start from first item of sch.shift_detailsList and the 8th entry in bindingSource1 (8) date should be nov 8th .but my issue is that now, the date in bindingSource1 (0) and sch.shift_detailsList (0) also becomes set to nov 8th. I dont know why this is happening.I would really appreciate if Anybody can help me please.    

 

 

 

            List<Model.Shiftdetails> schdetails = new List<Model.Shiftdetails>();

            bindingSource1.DataSource = schdetails;

            gridControl1.DataSource = bindingSource1;

          

            int k=0;

 

            for (int i = 0,j=0; i <=cycledays; i+=7)

            {

                foreach (Model.Shiftdetails detail in sch.shift_detailsList)

                {

                    Model.Shiftdetails cycleschdetails = new Model.Shiftdetails();

                    cycleschdetails = detail;

                    cycleschdetails.shift_date = dtCycleStartDate.DateTime.Date.AddDays(j);

                    

                    j++;

                    k++;

             

                    if (cycleschdetails.schedule == null)

                    {

                        cycleschdetails.schedule = new Model.Schedule { id = -1, schedule_info = new Model.ScheduleInfo { schedule_name = crm.GetString("NoShift") }, schedule_flexible = true };

                    }

                   

                    bindingSource1.Add(cycleschdetails);

                    bindingSource1.MoveNext();

 

                    if (k > cycledays)

                        break;

                  

                }

               

                if (k > cycledays)

                  break;

            } 

 

Thanks

Link to comment
https://www.neowin.net/forum/topic/1236287-bindingsource-value-getting-reset/
Share on other sites

1 answer to this question

Recommended Posts

This topic is now closed to further replies.
  • Posts

    • If nobody was using it. Then why specifically is it a shame? Windows needs be slimmer. Every feature like this is just more bloat
    • Invincible VS announced, a brutal 3v3 tag fighting game by former Killer Instinct developers by Pulasthi Ariyasinghe The Xbox Games Showcase showed off a brand-new fighting game incoming from the award-winning Invincible universe. Simply dubbed Invincible VS, the title will feature three versus three tag fighting with all sorts of heroes and villains from the franchise. Check out the announcement trailer above, which shows off some gameplay near the tail end of it. Published by Skybound Games and developed by Quarter Up, Invincible VS has a big focus on the brutality, much like its source material. There will be iconic arenas straight from the show, as well as a battle damage system to show off the carnage on the fighters themselves. "In Invincible VS, every move, every line of dialogue, every broken limb and bloodied mouth carries real cost and consequence—all building toward the bone-deep satisfaction of victory," said Invincible VS executive producer Mike Willette. "No tag fighting game has ever delivered this level of intensity and violence. This game is a love letter to the fighting game community, created by a team of passionate, experienced fans of the genre." While this is a brand-new studio that's taking on the project, it has been revealed that former members from the 2013 Killer Instinct are involved in the development. "I have said this before, and I’ll say it again: this is the most excited I’ve been about anything involving Invincible," said Invincible co-creator Robert Kirkman. "Invincible VS is crazy fun, fast, ferocious and dripping with the same over-the-top brutality that you’ll see in the comic book pages and on the show. It is a natural evolution of the franchise and it is everything that fans have been demanding for over a decade! This is without a doubt, probably the best superhero fighting game in the universe!" The title will have multiple game modes as well, including a campaign with an original story by the writer of the animated series, an arcade mode for skirmishes, and a training arena. As expected, competitive and casual online multiplayer will be available too. Invincible VS is coming out sometime in 2026 across PC, Xbox Series X|S, and PlayStation 5.
    • And how would a "real" handheld Xbox differed from that? Pray tell. Surely it too would've been a PC with a built in screen and controller, shoehorned into a handheld form factor, and running a flavour of optimised windows? You know Xbox Series X is just a PC running a heavily customised version of Windows 10, right?
    • Let me guess, just big hyped cut scenes for what is really just more run around in the same old static urban zone machine gun vs. sniper game play.
    • I am not seeing a huge difference there.
  • Recent Achievements

    • First Post
      George Almeyda earned a badge
      First Post
    • Reacting Well
      BlakeBringer earned a badge
      Reacting Well
    • Reacting Well
      Lazy_Placeholder earned a badge
      Reacting Well
    • Dedicated
      Epaminombas earned a badge
      Dedicated
    • Veteran
      Yonah went up a rank
      Veteran
  • Popular Contributors

    1. 1
      +primortal
      470
    2. 2
      +FloatingFatMan
      265
    3. 3
      ATLien_0
      235
    4. 4
      snowy owl
      219
    5. 5
      Edouard
      174
  • Tell a friend

    Love Neowin? Tell a friend!