Guru3D.com Forums

Go Back   Guru3D.com Forums > General > Programming/Html
Programming/Html C++,Visual Basic,HTML,Flash,OpenGL,Modelling,Java.



Reply
 
Thread Tools Display Modes
Column Appointment Time Cannot be found VB
Old
  (#1)
Alexis444
Master Guru
 
Alexis444's Avatar
 
Videocard: EVGA GTX 950 SSC 2GB
Processor: AMD FX 8350 Blk Ed
Mainboard: ASRock 970 Extreme4
Memory: Balistix 12Gb DDR3
Soundcard: VIA HD Audio (onboard)
PSU: Thermal TR2700w
Default Column Appointment Time Cannot be found VB - 11-23-2016, 13:21 | posts: 177 | Location: P.R.

Hey guys! Hope everyone is doing great!

As the tittle says, I am finishing a project, which is a medical registry patients for a hospice. I have a table named Appointments and this table has a column named Appointment Time Which handles the date and time of the appointments. The column was designed with the date/time feature in access. I am trying to get a color change in the rows with the date, like, if the appointment date has passed, changes to red and if still not passed stays white. Did some reseach and came out with this code:

Private Sub Appointments_DataBindingComplete(sender As System.Object, e As System.Windows.Forms.DataGridViewBindingCompleteEv entArgs) Handles AppointmentsDataGridView.DataBindingComplete
For i = 0 To AppointmentsDataGridView.Rows.Count - 4
Dim expDate As Date = AppointmentsDataGridView.Rows(i).Cells("Appointmen t Time").Value
If DateDiff(DateInterval.Month, Date.Now, expDate) <= 0 Then
AppointmentsDataGridView.Rows(i).DefaultCellStyle. BackColor = Color.Red
Else
AppointmentsDataGridView.Rows(i).DefaultCellStyle. BackColor = Color.White
End If
Next
End Sub

Everytime I run the debugger comes out with the error Column Appointment Time Cannot be found. Any one can see what I'm doing wrong
   
Reply With Quote
 
Old
  (#2)
mbk1969
Ancient Guru
 
mbk1969's Avatar
 
Videocard: GeForce GTX 970
Processor: I7-4930
Mainboard: Asus p9x79
Memory: G Skill RipjawZ, 16GB
Soundcard: Onboard + FiiO E17
PSU: 1000 W
Default 11-23-2016, 19:10 | posts: 3,507 | Location: Moscow, Russia

Try to enclose "Appointment Time" in "[]" - "[Appointment Time]".
   
Reply With Quote
Old
  (#3)
Alexis444
Master Guru
 
Alexis444's Avatar
 
Videocard: EVGA GTX 950 SSC 2GB
Processor: AMD FX 8350 Blk Ed
Mainboard: ASRock 970 Extreme4
Memory: Balistix 12Gb DDR3
Soundcard: VIA HD Audio (onboard)
PSU: Thermal TR2700w
Default 11-23-2016, 19:55 | posts: 177 | Location: P.R.

Quote:
Originally Posted by mbk1969 View Post
Try to enclose "Appointment Time" in "[]" - "[Appointment Time]".
I tried But came out with the same error. What I did was change the Appointment Time which is the name of the column to the number of the column. It worked but is highlighting the entire row instead of the column.

What I actually wants is to hightlight in red the appointments that has passed and the other that not stay in white.
   
Reply With Quote
Old
  (#4)
mbk1969
Ancient Guru
 
mbk1969's Avatar
 
Videocard: GeForce GTX 970
Processor: I7-4930
Mainboard: Asus p9x79
Memory: G Skill RipjawZ, 16GB
Soundcard: Onboard + FiiO E17
PSU: 1000 W
Default 11-24-2016, 10:33 | posts: 3,507 | Location: Moscow, Russia

Thats because you switch the background on whole row:
Quote:
AppointmentsDataGridView.Rows(i).DefaultCellStyle. BackColor = Color.Red
and you want the cell
Quote:
AppointmentsDataGridView.Rows(i).Cells(number).Def aultCellStyle. BackColor = Color.Red
   
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com
Copyright (c) 2017, All Rights Reserved. The Guru of 3D, the Hardware Guru, and 3D Guru are trademarks owned by Hilbert Hagedoorn.