Solved

changing background color cell datagridview

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

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now