473,396 Members | 1,815 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,396 software developers and data experts.

Windows Form DataGrid - Need A Color Border Around Only The Selected Row - Will GDI Be Required

I have a lot of colors, fonts, etc. to set for rows and possibly columns,
based on the information contained in the row and/or the selected row. A
main one is putting a border around the entire selected row only. The border
one does not seem to be simple thing to do by just setting a property of the
grid, DataGridTableStyle, GridColumnStyle, etc. It seems to require GDI
stuff like Paint, Brush, Region, Rectangle, etc. Is there an easier way than
all this custom GDI programming.

If custom programming is involved is there anyone who has sample of a nice
orderly, well structured object with best practices properties, methods,
etc. to do this type of thing? Or, failing that a good book recommendation.
Not a book that is really geared to heavy graphics but something like what
I'm looking to do with the DataGrid.

Nov 21 '05 #1
1 1054
Hi,

Maybe selecting the row will work for you.

Dim conn As SqlConnection

Dim strConn As String

Dim strSQL As String

Dim da As SqlDataAdapter

Dim ds As New DataSet

strConn = "Server = (local);"

strConn &= "Database = NorthWind;"

strConn &= "Integrated Security = SSPI;"

conn = New SqlConnection(strConn)

da = New SqlDataAdapter("Select * From Products", conn)

da.Fill(ds, "Products")

DataGrid1.DataSource = ds.Tables("Products")

For x As Integer = 0 To ds.Tables("Products").Rows.Count - 1

Dim dr As DataRow = ds.Tables("Products").Rows(x)

If CInt(dr.Item("UnitsInStock")) < 5 Then DataGrid1.Select(x)

Next

Ken

-----------------------
"Richard" <a@b.com> wrote in message
news:hT*********************@twister.nyc.rr.com...
I have a lot of colors, fonts, etc. to set for rows and possibly columns,
based on the information contained in the row and/or the selected row. A
main one is putting a border around the entire selected row only. The border
one does not seem to be simple thing to do by just setting a property of the
grid, DataGridTableStyle, GridColumnStyle, etc. It seems to require GDI
stuff like Paint, Brush, Region, Rectangle, etc. Is there an easier way than
all this custom GDI programming.

If custom programming is involved is there anyone who has sample of a nice
orderly, well structured object with best practices properties, methods,
etc. to do this type of thing? Or, failing that a good book recommendation.
Not a book that is really geared to heavy graphics but something like what
I'm looking to do with the DataGrid.


Nov 21 '05 #2

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

Similar topics

2
by: iwasinnihon | last post by:
I don't usually like to do this, but I need help. I have gone over this code and cannot figure out why it doesn't work. First of all it doesn't check to see if you have filled in the required...
2
by: Phil Stanton | last post by:
When designing a new form or report, the Default ForeColor is often something like -2147483640 which is the colour of Windows text (possibly black) and the default backColor is -2147483643...
1
by: Richard | last post by:
I have a lot of colors, fonts, etc. to set for rows and possibly columns, based on the information contained in the row and/or the selected row. A main one is putting a border around the entire...
5
by: tshad | last post by:
I have been trying to figure out what the Datagrid is doing to create its formatting. I found that some of my Datagrids have a 3D type of border and sometime it has a straight line. I finally...
4
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
9
by: mohit.akl | last post by:
Hey guys & gals I am havng trouble modifying the control box. I want to make the maximise button invisible and have minimisise button instead of it. Like this _ X (not like _ o X ) How...
4
by: Greg Scharlemann | last post by:
I'm trying to setup a dyamic dropdown list that displays a number of text fields based on the selected number in the dropdown. The problem I am running into is capturing the data already entered...
16
by: printline | last post by:
I have a problem with some validation of some fields in a form. I have some fields that only become visible if a specific field is chosen. For example: <select...
1
by: morangi | last post by:
<?php session_start(); error_reporting(E_ERROR && ~E_NOTICE && ~E_WARNING); ob_start(); $link = mysql_connect('localhost', 'root', 'test'); if (!$link) { die('Could not connect: ' ....
3
by: blackrunner | last post by:
ERROR in my Query?! ERROR: Element GESCHLECHT is undefined in FORM. i think everything ok. Maby somebody can help me here Element GESCHLECHT is undefined in FORM. The error occurred...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.