Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > .NET Framework 2.0
|
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 4th, 2005, 08:46 PM
Registered User
 
Join Date: Nov 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need Help - Bound DataGridView Formatting Problem

I have a DataTable bound to a BindingSource to a DataGridView.. I have no problems formatting the entire DGV, but I can't format (change cell style) individual rows,columns or cells..

The blue line works, the red line does not.. they both compile, only one is effective though..

This code is barely removed from sample code, I have no idea what's going on.

Thanks in advance,
Mike

Code:
DataTable workTable = new DataTable("Jan06");
BindingSource bs = new BindingSource();

workTable.Columns.Add("Call", typeof(Double));

...
for (int i = 0; i < 12; i++)
{
   DataRow workRow = workTable.NewRow();
   workRow[0] = 10 + i;
   ...
   workTable.Rows.Add(workRow);
}

bs.DataSource = workTable;
dataGridView1.DataSource = bs;

dataGridView1.DefaultCellStyle.ForeColor = Color.Blue;
dataGridView1.Columns["Call"].DefaultCellStyle.ForeColor = Color.Red;





Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGridView Problem testsubject Visual Studio 2005 0 January 2nd, 2007 08:55 AM
Formatting TextBox bound to a database column Raby Visual Basic 2005 Basics 1 September 6th, 2006 07:47 PM
Formatting number in DataGridView not working! RMan54 General .NET 2 July 27th, 2006 06:01 PM
Item Data Bound Problem rstelma ASP.NET 1.0 and 1.1 Professional 3 January 25th, 2006 05:39 PM





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