Solved

changing background color cell datagridview

Posted on 2011-03-25
3
746 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

713 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