Set backcolor for specific cell in gridview in VB.net Visual Studio

I have a fixed size grid and would like to specify the backcolor of specific cells within the grid, so not whole rows and not whole columns just a single cell or maybe a range of cells. Please see the screenshot below for and example of what I mean.

Ideally I would like to do this via vb as I would ultimately like to alter the backcolor based on values selected from a dropdown list.

Edit:

Based on the answer below I modified it until I got the below which worked.

GridView.Rows(n).Cells(n).BackColor = Drawing.Color.FromArgb(n, n, n)

Answers


Assuming you are creating a windows forms application, you can use the DataGridView. It allows individual cells to be styled using the following property:

dataGridView1.Rows[0].Cells[0].Style.BackColor = Color.Red

Need Your Help

Data Conversion Issue in SSIS package - Text to GUID

sql-server-2008 excel ssis data-conversion

I am developing a SSIS package that will open an Excel spreadsheet and import the data into a database table in SQL Server 2008. When I try to convert the Excel column data type: Unicode String

Text underline and highlight in PDF rendering

iphone ios ipad pdf-generation

I am using the following project from git hub for PDF rendering, But i need to provide user with the feature of underlining the text and highlighting text in the PDF

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.