Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

changing background color cell datagridview

Posted on 2011-03-25
3
Medium Priority
?
767 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

604 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