473,546 Members | 2,644 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error load meeting and time to datagridview

5 New Member
I have 2 table on api data: Booking{ Id, Status, Sort, CreatedDate,Upd atedAt, Title, ParticipatingLe aders, Content, UserCreatedName , UserCreatedEmai l, UserCreatedPhon eNumber, DepartmentId, Start, Stop, LocationId, Request,RoomId, Date, CancelAt, SuccessAt,HostU ser, LocationName, RoomName }

Room{ Id, Status, Sort, CreatedDate, CreatedAt, UpdatedAt, UpdatedBy, CodeNaame, Name, LocationId, Volumn, Items, Images }

After booking and save the meeting room, the data will be submitted to the Booking table. on form i create datagridview to view

meeting schedule and meeting room get the list of rooms in the Room api table and add new hour columns

add a new column that is the time and get the data to browse the Booking table to compare the start time and end time of the meeting

like code and picture. convert columns header is hour to compare and get the time range and load the color to know which room is meeting at which time

in the load event call the function: selectAreaColor () then got an error, but the load function does not call and book the room,

it can run and get the results as shown, but when starting to run and the load function calls, the error hope everyone can help, thanks a lot. when adding new run debug, it browses from column header at 08:00 to the end of column and booking table data runs ok and the load event, it browses the data from the booking table to the columns on the datagridview, so it crashes


Expand|Select|Wrap|Line Numbers
  1. here is the code to get the display area of meeting time and meeting schedule
  2.  
  3. private void selectAreaColor()
  4.  
  5. {
  6.  
  7. string starttime ;
  8.  
  9. string stoptime ;
  10.  
  11. string selectedRoom ;
  12.  
  13. string selectedId ;
  14.  
  15. QueryRQ query = CreateQuery();
  16.  
  17. BookingIndexRS result = apiBooking.getBooking(query).Result;
  18.  
  19. foreach (BookingDetail r in result.Data)
  20.  
  21. {
  22.  
  23. string idLocal = r.Id.ToString();
  24.  
  25. selectedId = idLocal + "";
  26.  
  27. string idroom = r.RoomId.ToString();
  28.  
  29. selectedRoom = idroom + "";
  30.  
  31. string start = r.Start.ToString();
  32.  
  33. starttime = start;
  34.  
  35. string stop = r.Stop.ToString();
  36.  
  37. stoptime = stop;
  38.  
  39. string getDate =(r.Date.ToString());
  40.  
  41. // Get the start time and end time inputs and the selected meeting room
  42.  
  43. DateTime startTime = DateTime.ParseExact(starttime, "HH:mm", null);
  44.  
  45. DateTime stopTime = DateTime.ParseExact(stoptime, "HH:mm", null);
  46.  
  47. foreach (DataGridViewRow row in grdRoom.Rows)
  48.  
  49. {
  50.  
  51. if (row.Cells["Id"].Value.ToString() == selectedRoom)
  52.  
  53. {
  54.  
  55. int rowIndex = row.Index;
  56.  
  57. // Loop through the columns and compare the start and end times with the time slots
  58.  
  59. for (int i = 1; i < grdRoom.Columns.Count; i++)
  60.  
  61. {
  62.  
  63. DateTime columnTime = DateTime.ParseExact(grdRoom.Columns[i].HeaderText, "HH:mm", CultureInfo.InvariantCulture);//event load here error while add new not error, but call on event load is error
  64.  
  65. string _HeaderText = grdRoom.Columns[i].Name.ToString();
  66.  
  67. if (startTime == columnTime)//|| endTime == columnTime
  68.  
  69. {
  70.  
  71. grdRoom.Rows[rowIndex].Cells[_HeaderText].Style.BackColor = Color.Blue;
  72.  
  73. if (startTime == stopTime)
  74.  
  75. return;
  76.  
  77. else
  78.  
  79. startTime = startTime.AddMinutes(30);
  80.  
  81. }
  82.  
  83. }
  84.  
  85. }
  86.  
  87. }
  88.  
  89. }
  90.  
  91. }
Mar 9 '23 #1
0 1203

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3985
by: Dave Smithz | last post by:
Hi, My PHP application for a client uses the publicly available "PHPMailer - PHP email class" which is very good. However, my client recently complained about the following error when sending out over 4000 emails. (Note that each email is customised so needs to be sent individually - not using Bcc). The application reported to have sent...
4
5259
by: Gary Davis | last post by:
Once a day or so, I receive an error on a fairly active website that calls this StrMixed.cs method constructor. 99% of the time there is no exception: System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.InvalidOperationException: Hashtable insert failed. Load factor too high. at...
1
2148
by: Mark | last post by:
I have .aspx code-behinds that inherit from the class below. The code runs just fine, but the form designer bombs at design time when trying to view the .aspx page in VS.NET 2003. If I comment out the single line of code below, then there is no error. I posted the error message below - it implies that this code is being run at design time,...
1
1591
by: Manuel Canas | last post by:
Hello there, I am using the VB.NET Standart Edition compiler and I would like to know if this is not supported on this edition. This is just a testing code from a book that I'm trying here and it builds with no problem, but when I run it I get and error. This is the code snipet;
2
6679
by: Henry J. | last post by:
When the user loads the data into a DataGridView, some error icons may be shown to indicate some errors like when uniqueness is violated. The user can go ahead modifying the data rows. Once the violation is fixed, I like to clear the error icons, but I could not do so. Any tips? Thanks a lot!
0
1364
by: mfareezaw | last post by:
dears i need an axample how to get time and how to load numbers from file in the disk i found this in the help but it is not printing #include <stdio.h> #include <dos.h> int main(void)
1
1726
by: Adam Porter | last post by:
First off, I've placed my very first webservice on the web and can access the .asmx file through my browser. Now, as I'm writing my Client App, I want to call these services. I'm getting a strange error at Compile-Time on all of my WebService calls. Here's some basic information. Have you seen anything like this before...and/or know how to fix it...
10
3857
by: pooja8389 | last post by:
In this program there is error in processing time of last process..plz check the error... the program is as #include<stdio.h> #include<conio.h> void main() { float avgwt,avgtt; char pname,c; int wt,tt,bt,at,t,q,i,n,sum=0,sbt=0,ttime,j,ss=0; clrscr();
3
3721
by: agarwalsunitadhn | last post by:
Hi I have a problem that whenever i fetch a large amount of data from database then it shows the following error with a part of result: Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\fps\report7.php on line 95. and refreshing that page . we got the complete data. If you have any suggestion that how to fetch...
0
1137
by: hoangluc19 | last post by:
I have 2 table on api data: Booking{ Id, Status, Sort, CreatedDate,UpdatedAt, Title, ParticipatingLeaders, Content, UserCreatedName, UserCreatedEmail, UserCreatedPhoneNumber, DepartmentId, Start, Stop, LocationId, Request,RoomId, Date, CancelAt, SuccessAt,HostUser, LocationName, RoomName } Room{ Id, Status, Sort, CreatedDate, CreatedAt,...
0
7504
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7435
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7694
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
6026
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3491
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1921
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.