Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 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 January 22nd, 2008, 04:48 AM
Authorized User
 
Join Date: Jul 2007
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default Style property of datagridview

Hello,

 Here i go with my problem.

  I want one of my cell to be like(look like) header cell.

  So i am using style property of header cell. My code looks like his


  DataGridViewCell dgvCell = dataGridView1.Rows[0].Cells[0];
  dgvCell.Style = dataGridView1.Columns[0].HeaderCell.Style;


But it is not working . Suggest me something.

With regards,
 
Old January 22nd, 2008, 06:07 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

What isn't happening?

Have you read this: http://msdn2.microsoft.com/en-us/library/1yef90x0.aspx

Have you tried setting whatever property of the style you want to change manually (e.g. font, boldness, width, colour?)

/- Sam Judson : Wrox Technical Editor -/
 
Old January 22nd, 2008, 09:58 PM
Authorized User
 
Join Date: Jul 2007
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for reply.

The header style is not assigning to cell of the datagridview.

yes, i tried to set individual properties like forecolor, backcolor,but went in vein.

datagridview1.rows[0].cells[0].style.foreground = color.gray //works

datagridview1.rows[0].cells[0].style.foreground = datagridview1.columns[0].headercell.style.foreground // doesnot work

Is there any solution.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Style wiegel BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 February 27th, 2007 09:28 PM
Help with style Boomah XSLT 4 November 2nd, 2006 09:19 AM
DataGridView nnmrao Visual Studio 2005 0 February 7th, 2006 02:08 AM
Losing style property stephanel VS.NET 2002/2003 10 August 12th, 2004 07:50 PM
difference between style.visibility and style.disp Mimi Javascript How-To 6 September 17th, 2003 11:50 PM





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