Solved

changing background color cell datagridview

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

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 …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

827 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