Solved

changing background color cell datagridview

Posted on 2011-03-25
3
732 Views
Last Modified: 2012-05-11
2 buttons, 1 datagridview.
using visual basic .net on visual studio 2008. this datagrid view is a native control.

the grid shows the schedule of a specific doctor for every turn (20minute invervals)
besides other funcionalities, if a certain field is selected (say, dr Cucho Gamba at 8.20), 1 button must change the background to green and the other button must change it to red.

Other functionalities include changing the state of that field (if its only reserved or if its been payed for) but that has already been handled.

Any assistance is greaty appreciated, let me know if more info is needed.
schedule.JPG
0
Comment
Question by:infogws
  • 2
3 Comments
 
LVL 13

Expert Comment

by:gamarrojgq
ID: 35220752
Hi,

To change the backcolor of the selected cell (the one that user click on)  you have to use the style of the current cell like this (assuming that your datagridview name is datagridview1)

'Green Color
DataGridView1.CurrentCell.Style.BackColor = Color.LightGreen

'Red Color
DataGridView1.CurrentCell.Style.BackColor = Color.Red
0
 

Accepted Solution

by:
infogws earned 0 total points
ID: 35375399
0
 

Author Closing Comment

by:infogws
ID: 35410233
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question