Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 22nd, 2006, 08:26 AM
Registered User
Join Date: Jun 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default change cell color

Hi, I bound DataSet to DataGridview to display data from SQL DB, I want to change row color to blue, red or write based on row data retrived if the row data meet some condition, any clue?


Reply With Quote
  #2 (permalink)  
Old July 13th, 2006, 04:39 AM
Registered User
Join Date: Jul 2006
Location: Jaipur, , India.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

This is code to solve your problem

Private Sub dgGrid_RowPrePaint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewRowPrePaintEventA rgs) Handles dgGrid.RowPrePaint
        Dim tmpCell As New DataGridViewCellStyle()
        tmpCell.BackColor = Color.Beige
            If GetProperGridCellValue(dgGrid.Item("qty", e.RowIndex), 0) = 1 Then dgGrid.Rows(e.RowIndex).DefaultCellStyle = tmpCell

        End Try
    End Sub

Reply With Quote
  #3 (permalink)  
Old October 4th, 2006, 08:55 AM
Registered User
Join Date: Oct 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Mracket

Maybe a stupid question, but vs say that GetProperGridCellValue is not declared when it read that code. What is it meant to be dim as ?

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get Excel Cell color populate .NET Framework 2.0 2 March 3rd, 2014 04:25 AM
Change border color for every cell of a table jdang67 CSS Cascading Style Sheets 10 May 6th, 2010 12:21 AM
Change the backround color to cell ricespn Beginning VB 6 0 November 4th, 2006 12:39 PM
Change Cell Color phungleon HTML Code Clinic 2 April 9th, 2006 12:36 AM
change background color of cell based on value vurtman ASP.NET 1.0 and 1.1 Basics 4 February 26th, 2004 03:52 PM

All times are GMT -4. The time now is 11:10 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.