473,772 Members | 2,442 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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, DataGridTableSt yle, 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 17 '05 #1
1 1454
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(s trConn)

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

da.Fill(ds, "Products")

DataGrid1.DataS ource = ds.Tables("Prod ucts")

For x As Integer = 0 To ds.Tables("Prod ucts").Rows.Cou nt - 1

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

If CInt(dr.Item("U nitsInStock")) < 5 Then DataGrid1.Selec t(x)

Next

Ken

-----------------------
"Richard" <a@b.com> wrote in message
news:hT******** *************@t wister.nyc.rr.c om...
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, DataGridTableSt yle, 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 17 '05 #2

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

Similar topics

2
2295
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 fields. Second, it doesn't submit the information (it's supposed to send it to mySql and email it to me.) and lastly, it doesn't bring up the thankyou.php after submitting the form. I don't know enough about PHP to find the problem. If someone could...
4
3516
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 click a button on a pop-up window the javascript for that button click does a 'button.form.submit'. On the Server side there is a Button click event for this button, but for some reason it no longer fires. It worked fine before and everything...
1
1074
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 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...
9
12849
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 to do this... and eventually i want to modify the control box in the form of ? _ X ... I.e. adding a new button to control box. I need to detect the click events.
0
9621
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10264
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10039
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8937
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2851
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.