Is there a way to change the foreground or background color of a
single cell in an unbound datagridview? 11 109538
dgk wrote: Is there a way to change the foreground or background color of a single cell in an unbound datagridview?
Use the "Style" property -
DataGridView1.Item(ColumnIndex, RowIndex).Style.BackColor = Color
DataGridView1.Item(ColumnIndex, RowIndex).Style.ForeColor = Color
or
DataGridView1.CurrentCell.Style.BackColor = Color
DataGridView1.CurrentCell.Style.ForeColor = Color
Hope this answers your question.
ShaneO
There are 10 kinds of people - Those who understand Binary and those who
don't.
DGK,
AFAIK can you as a from a normal textbox, can you not colour the background
of a textbox backgroud. There is no background at all in those.
You can change the borders.
Here a sample from that on our website. http://www.vb-tips.com/default.aspx?...4-5967be300f0a
I hope this helps,
Cor
"dgk" <No*****@MailsAnonymous.com> schreef in bericht
news:aj********************************@4ax.com... Is there a way to change the foreground or background color of a single cell in an unbound datagridview?
On Mon, 10 Apr 2006 10:08:48 +1000, ShaneO <sh******@optusnet.com.au>
wrote: dgk wrote: Is there a way to change the foreground or background color of a single cell in an unbound datagridview?
Use the "Style" property -
DataGridView1.Item(ColumnIndex, RowIndex).Style.BackColor = Color DataGridView1.Item(ColumnIndex, RowIndex).Style.ForeColor = Color
or
DataGridView1.CurrentCell.Style.BackColor = Color DataGridView1.CurrentCell.Style.ForeColor = Color
Hope this answers your question.
ShaneO
There are 10 kinds of people - Those who understand Binary and those who don't.
Yes, that works, thanks. Amazing how hard that is to find.
Cor Ligthert [MVP] wrote: DGK,
AFAIK can you as a from a normal textbox, can you not colour the background of a textbox backgroud. There is no background at all in those.
You can change the borders. Here a sample from that on our website.
http://www.vb-tips.com/default.aspx?...4-5967be300f0a
Does anyone know the English translation of what was written above????
ShaneO
There are 10 kinds of people - Those who understand Binary and those who
don't.
Shane,
There are people who are able to understand what somebody (although it is
written syntactical wrong), and those who don't. It is a fine selection to
select real developers. AFAIK can you as a from a normal textbox, can you not colour the background of a textbox backgroud. There is no background at all in those.
I did correct this sentence afterwards to much it had to be.
AFAIK you can from a normal textbox not colour the background. There is no
background at all in those.
Cor
"ShaneO" <sh******@optusnet.com.au> schreef in bericht
news:44**********************@news.optusnet.com.au ... Cor Ligthert [MVP] wrote: DGK,
AFAIK can you as a from a normal textbox, can you not colour the background of a textbox backgroud. There is no background at all in those.
You can change the borders. Here a sample from that on our website.
http://www.vb-tips.com/default.aspx?...4-5967be300f0a
Does anyone know the English translation of what was written above????
ShaneO
There are 10 kinds of people - Those who understand Binary and those who don't.
Cor Ligthert [MVP] wrote: Shane,
There are people who are able to understand what somebody (although it is written syntactical wrong), and those who don't. It is a fine selection to select real developers.
I did correct this sentence afterwards to much it had to be.
AFAIK you can from a normal textbox not colour the background. There is no background at all in those.
Cor
Cor, at the risk of maintaining confusion, I still don't know what
you're on about!!
The original poster asked for a way to change the color of the
foreground and background of a DataGridView Cell. I provided an answer
(which was later acknowledged as being what the original poster was
seeking) but around 6 hours later you posted a reply which looks like
you're saying it can't be done, or at the least, should be done some
other way????
I respect any comments you may have, after all you are a MVP, but PLEASE
carefully explain what point you're trying to make by correcting my
suggestion, if that is what you're trying to do???
ShaneO
There are 10 kinds of people - Those who understand Binary and those who
don't.
Shane,
Simple, I was reading a DataGrid and did not know that it was done in the
DataGridView in this way. Just word blindness at that moment. Can happen to
me.
I am glad that this is as well done in the datagridview, so now I know that.
But a simple message attending me on this, does more than making a kind of
flame from it.
Thanks,
Cor
"ShaneO" <sh******@optusnet.com.au> schreef in bericht
news:44***********************@news.optusnet.com.a u... Cor Ligthert [MVP] wrote: Shane,
There are people who are able to understand what somebody (although it is written syntactical wrong), and those who don't. It is a fine selection to select real developers.
I did correct this sentence afterwards to much it had to be.
AFAIK you can from a normal textbox not colour the background. There is no background at all in those.
Cor Cor, at the risk of maintaining confusion, I still don't know what you're on about!!
The original poster asked for a way to change the color of the foreground and background of a DataGridView Cell. I provided an answer (which was later acknowledged as being what the original poster was seeking) but around 6 hours later you posted a reply which looks like you're saying it can't be done, or at the least, should be done some other way????
I respect any comments you may have, after all you are a MVP, but PLEASE carefully explain what point you're trying to make by correcting my suggestion, if that is what you're trying to do???
ShaneO
There are 10 kinds of people - Those who understand Binary and those who don't.
ShaneO,
Now I think that I remember me again why I wrote that message.
I thought that Ken had made a complete sample and was searching for that,
but could not find it and that took some time.
Than I remembered me that not existing of a background in a textbox and
found it stupid from myself that I had searched for it.
At that time I was forgotten that you had given an answer
Than I took the sample I had found (which is one of me) and wrote that text.
Although I could not find the right words to describe that and made that
hash text.
Now I know from your message that it is done direct in the cell.
There was not any more intention with that.
If you had asked this direct, than I had probably explained direct. However
flaming me by asking to the public what I had written did not give me a good
thought about you. You could have done that direct to me, and helped me with
that, the sentence was unreadable without investigation.
Cor
"ShaneO" <sh******@optusnet.com.au> schreef in bericht
news:44***********************@news.optusnet.com.a u... Cor Ligthert [MVP] wrote: Shane,
There are people who are able to understand what somebody (although it is written syntactical wrong), and those who don't. It is a fine selection to select real developers.
I did correct this sentence afterwards to much it had to be.
AFAIK you can from a normal textbox not colour the background. There is no background at all in those.
Cor Cor, at the risk of maintaining confusion, I still don't know what you're on about!!
The original poster asked for a way to change the color of the foreground and background of a DataGridView Cell. I provided an answer (which was later acknowledged as being what the original poster was seeking) but around 6 hours later you posted a reply which looks like you're saying it can't be done, or at the least, should be done some other way????
I respect any comments you may have, after all you are a MVP, but PLEASE carefully explain what point you're trying to make by correcting my suggestion, if that is what you're trying to do???
ShaneO
There are 10 kinds of people - Those who understand Binary and those who don't.
On Wed, 12 Apr 2006 08:48:27 +0200, "Cor Ligthert [MVP]"
<no************@planet.nl> wrote: ShaneO,
Now I think that I remember me again why I wrote that message.
I thought that Ken had made a complete sample and was searching for that, but could not find it and that took some time.
Than I remembered me that not existing of a background in a textbox and found it stupid from myself that I had searched for it.
At that time I was forgotten that you had given an answer
Than I took the sample I had found (which is one of me) and wrote that text. Although I could not find the right words to describe that and made that hash text.
Now I know from your message that it is done direct in the cell.
There was not any more intention with that.
If you had asked this direct, than I had probably explained direct. However flaming me by asking to the public what I had written did not give me a good thought about you. You could have done that direct to me, and helped me with that, the sentence was unreadable without investigation.
Cor
As the OP, I'd just like to thank everyone for helping. I can't
imagine what I'd do without the folks here.
Cor Ligthert [MVP] wrote: ShaneO,
Now I think that I remember me again why I wrote that message.
I thought that Ken had made a complete sample and was searching for that, but could not find it and that took some time.
Than I remembered me that not existing of a background in a textbox and found it stupid from myself that I had searched for it.
At that time I was forgotten that you had given an answer
Than I took the sample I had found (which is one of me) and wrote that text. Although I could not find the right words to describe that and made that hash text.
Now I know from your message that it is done direct in the cell.
There was not any more intention with that.
If you had asked this direct, than I had probably explained direct. However flaming me by asking to the public what I had written did not give me a good thought about you. You could have done that direct to me, and helped me with that, the sentence was unreadable without investigation.
Cor
Cor, I'm sorry if it appeared as a "Flame". It was my poor attempt at
humour, which obviously does not translate well in a written message.
Best Regards,
ShaneO
There are 10 kinds of people - Those who understand Binary and those who
don't.
Shane,
No problem. exactly as you wrote.
Cor
"ShaneO" <sh******@optusnet.com.au> schreef in bericht
news:44***********************@news.optusnet.com.a u... Cor Ligthert [MVP] wrote: ShaneO,
Now I think that I remember me again why I wrote that message.
I thought that Ken had made a complete sample and was searching for that, but could not find it and that took some time.
Than I remembered me that not existing of a background in a textbox and found it stupid from myself that I had searched for it.
At that time I was forgotten that you had given an answer
Than I took the sample I had found (which is one of me) and wrote that text. Although I could not find the right words to describe that and made that hash text.
Now I know from your message that it is done direct in the cell.
There was not any more intention with that.
If you had asked this direct, than I had probably explained direct. However flaming me by asking to the public what I had written did not give me a good thought about you. You could have done that direct to me, and helped me with that, the sentence was unreadable without investigation.
Cor
Cor, I'm sorry if it appeared as a "Flame". It was my poor attempt at humour, which obviously does not translate well in a written message.
Best Regards,
ShaneO
There are 10 kinds of people - Those who understand Binary and those who don't. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Michael |
last post by:
How can I use onclick to change a table cell background color. I know
I can use this.className=?
to change the classname. But then I would have to put the code into
every single table cell. I...
|
by: Vam |
last post by:
Hi,
My program makes an HTML report which needs to be easily printable. On this
report is a table, and one of the columns in the table needs to express a
color. I've done this by setting the...
|
by: martin1 |
last post by:
Hi, all,
Is there any way to change DataGridView row color based on different row
data? for example, if row data in first column = 1, it is yellow, if it is 2,
it is blue, if 3 it is white. That...
|
by: Thanu |
last post by:
Hi,
I want to import the background color of cells from excelsheet to Mshflexgrid in Vb6. I already have the code to import the contents from excel to mshflexgrid but i want to import the color...
|
by: =?Utf-8?B?R3JlZyBMYXJzZW4=?= |
last post by:
I'm populating a datagridview from a data table. I would like to set the
back ground color of each row based on a column value in that row. If the
value of a column for a particular row is set...
|
by: dowlingpc |
last post by:
Has anyone discovered a way to control the background color of individual "cells" based on the cells content?
When the cell has a negative value or is without content I'd like to change its...
|
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= |
last post by:
I understand how to connect a SqlDataSource to a GridView and have a nice
data-connected, paginated web page generated with virtually no coding.
Starting from that base, I would like to add an...
|
by: Chanman |
last post by:
I've posted this on the python-excel group, but perhaps people here
know what to do.
How does one change the cell background color using the xlwt module?
I've looked at several tutorials but...
|
by: patrick.waldo |
last post by:
Hi all,
I am trying to figure out a way to read colors with xlrd, but I did
not understand the formatting.py module. Basically, I want to sort
rows that are red or green. My initial attempt...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |