473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Highlighting text in DataGridView

sh
How can I highlight the text in a cell, as if it had been selected with
the mouse?

I have a validation routine that checks the data in each column. If a
cell fails the validation, I show a MessageBox with an error message. I
then want to highlight the bad data. But I can't seem to do that.

I don't want to change the background color, nor the foreground color. I
just want to highlight it as if it had been selected by mouse.

In a TextBox, there is SelectionStart and SelectionLength. Is there
something similar in a DataGridView?

Thanks in advance.
May 31 '06 #1
1 2728
..Net 2005:

DataGridView1.Rows(0).Cells(0).Style.BackColor = Color.Yellow

[]s

Cesar
"sh" <sh*****@prupipe.com> wrote in message news:7I***************@newsread3.news.pas.earthlin k.net...
How can I highlight the text in a cell, as if it had been selected with
the mouse?

I have a validation routine that checks the data in each column. If a
cell fails the validation, I show a MessageBox with an error message. I
then want to highlight the bad data. But I can't seem to do that.

I don't want to change the background color, nor the foreground color. I
just want to highlight it as if it had been selected by mouse.

In a TextBox, there is SelectionStart and SelectionLength. Is there
something similar in a DataGridView?

Thanks in advance.

Jun 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bob hotmail.com> | last post by:
Everyone I have been spending weeks looking on the web for a good tutorial on how to use regular expressions and other methods to satisfy my craving for learning how to do FAST c-style syntax...
4
by: Patrick Porter | last post by:
Arrrgh! I have tried everything (ok, not EVERYTHING) but i cant get solve the problem of getting syntax highlighting in a rich textbox. in the code below, im attempting to highlight all of the...
4
by: lord.zoltar | last post by:
I am wondering how you guys highlight cells or rows (by changing the text or background colour) in a DataGridView. Right now, I apply styles to certain rows or cells in the CellFormatting even...
2
by: Steve Richter | last post by:
I set the Text of a DataGridView control expecting this text to be displayed at the top of the control, as the grid title. But the text does not display. How do I display title text above the...
7
by: Leif902 | last post by:
After much searching of google, the closest I can find is highlighting search terms... however, this is not what I wanted to do. Does anyone know how to parse through a specific element (lets say...
14
by: > Adrian | last post by:
Is there a way of stopping text from highlighting in textbox? Many thanks, Adrian.
0
by: Scott | last post by:
Hi, I think I may have finally found a IDE/text editor that I like, but, it still haves one problem. Geany haves syntax highlighting, but it is not very good for Python. It only seems to have...
1
by: Andrus | last post by:
I have Text box controls and DataGridView control in WinForms form. DataGridview contains custom ComboBox columns and standard TextBox columns. Edit mode is EditOnEnter. When focus is moved...
1
by: alamodgal | last post by:
hiiiiiii I have a problem in highlighting searching keyword.Actually im using this function for searching Public Function HighLight(ByVal Keyword As String, ByVal ContentFor As String) Dim...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.