|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Why not color?I'm writing a program in VB .NET 2k3, I have a datagrid bound to a database
(Access 2002). Does anyone have info or know where I can go to change the color of a row based on the value in one column? I have found stuff on alternating colors and all that good stuff but nothing that I need. Thanks Hi Brix,
Have a look at: http://64.78.52.104/FAQ/WinForms/default.asp under the datagrid section. Item 5.14 might be helpful Doug Show quoteHide quote "brix_zx2" <brix***@discussions.microsoft.com> wrote in message news:D0CF6BDB-EFEE-4F1A-9E67-43D3CF2AA637@microsoft.com... > I'm writing a program in VB .NET 2k3, I have a datagrid bound to a database > (Access 2002). Does anyone have info or know where I can go to change the > color of a row based on the value in one column? I have found stuff on > alternating colors and all that good stuff but nothing that I need. Thanks It'd be nice to have conditional formatting as found in Access, wouldn't
it? :) Thankfully there's another way. You can attach a handler to the ItemDataBound event of the DataGrid class. This event is fired once for each row in your datagrid. Check the appropriate field, and if it matches your requirements, colour the entire row. --- Private Sub OnItemDataBound(Sender as Object, E as DataGridItemEventArgs) Handles DataGrid1.ItemDataBound If CType(e.Item.DataItem, DataRowView)("YourColumn") = 3 Then E.Item.BackColor = KnownColor.AliceBlue End IF End Sub --- Hope that helps you. Regards, -Adam. brix_zx2 wrote: Show quoteHide quote > I'm writing a program in VB .NET 2k3, I have a datagrid bound to a database > (Access 2002). Does anyone have info or know where I can go to change the > color of a row based on the value in one column? I have found stuff on > alternating colors and all that good stuff but nothing that I need. Thanks "brix_zx2" <brix***@discussions.microsoft.com> schrieb: (Syncfusion links may be slow...)> I'm writing a program in VB .NET 2k3, I have a datagrid bound to a > database > (Access 2002). Does anyone have info or know where I can go to change the > color of a row based on the value in one column? 5.14 How do I color a individual cell depending upon its value or some external method? <URL:http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q745q> 5.67 How can I change the font used in a grid cell on a cell by cell or row by row basis? <URL:http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q927q> Changing the background color of cells in a DataGrid <URL:http://www.codeproject.com/csharp/custom_datagridcolumnstyl.asp> <URL:http://www.google.de/groups?selm=avm8j6%24guusa%241%40ID-117757.news.dfncis.de> -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> |
|||||||||||||||||||||||