Click here to Skip to main content
15,889,867 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: DataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Dave Kreskowiak22-Apr-15 4:15
mveDave Kreskowiak22-Apr-15 4:15 
GeneralRe: DataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Johan Hakkesteegt22-Apr-15 20:26
Johan Hakkesteegt22-Apr-15 20:26 
GeneralRe: DataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Johan Hakkesteegt22-Apr-15 21:21
Johan Hakkesteegt22-Apr-15 21:21 
GeneralRe: DataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Dave Kreskowiak23-Apr-15 2:20
mveDave Kreskowiak23-Apr-15 2:20 
GeneralRe: DataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Johan Hakkesteegt23-Apr-15 3:46
Johan Hakkesteegt23-Apr-15 3:46 
GeneralRe: DataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Dave Kreskowiak23-Apr-15 4:05
mveDave Kreskowiak23-Apr-15 4:05 
GeneralRe: DataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Johan Hakkesteegt23-Apr-15 22:21
Johan Hakkesteegt23-Apr-15 22:21 
GeneralRe: DataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Dave Kreskowiak24-Apr-15 3:49
mveDave Kreskowiak24-Apr-15 3:49 
There is probably something in between this method and the other one. Having multiple methods to format a grid is a bad idea because of the problem you're running into, though it's, sadly, kind of common.

If I have multiple grids I need formatted differently, but overall styled the same, I normally create my own DGV class, inheriting from the .NET DGV, setup the base styles common to all grids, then use that I my forms.

When I need to setup formatting, I have a method on the form that hosts the grid explicitly setting up the one grid instance with the things that are over and above the items setup in the base grid. This sometimes results in a duplication of code but I consider that a small price to pay for flexibility when I need to change a grid here and there.


Now, you might want to step through this code and the other code. It would appear that you're replacing the entire style of a column instead of making changes to it. If this code is called to setup your grid and then you call the other method to further change it you could be replacing the styles from one method with the styles from another instead of making changes to the style that is in place.
A guide to posting questions on CodeProject

Click this: Asking questions is a skill.
Seriously, do it.

Dave Kreskowiak

GeneralRe: DataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Johan Hakkesteegt24-Apr-15 4:03
Johan Hakkesteegt24-Apr-15 4:03 
AnswerRe: DataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Eddy Vluggen22-Apr-15 4:51
professionalEddy Vluggen22-Apr-15 4:51 
GeneralRe: DataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Johan Hakkesteegt22-Apr-15 20:31
Johan Hakkesteegt22-Apr-15 20:31 
GeneralRe: DataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Eddy Vluggen22-Apr-15 22:38
professionalEddy Vluggen22-Apr-15 22:38 
QuestionUnsure How to Approach New Personal Project Pin
cyberphreak198121-Apr-15 7:06
cyberphreak198121-Apr-15 7:06 
AnswerRe: Unsure How to Approach New Personal Project Pin
Sascha Lefèvre21-Apr-15 7:24
professionalSascha Lefèvre21-Apr-15 7:24 
GeneralRe: Unsure How to Approach New Personal Project Pin
cyberphreak198121-Apr-15 7:27
cyberphreak198121-Apr-15 7:27 
GeneralRe: Unsure How to Approach New Personal Project Pin
Sascha Lefèvre21-Apr-15 7:36
professionalSascha Lefèvre21-Apr-15 7:36 
GeneralRe: Unsure How to Approach New Personal Project Pin
cyberphreak198121-Apr-15 7:40
cyberphreak198121-Apr-15 7:40 
GeneralRe: Unsure How to Approach New Personal Project Pin
Sascha Lefèvre21-Apr-15 8:34
professionalSascha Lefèvre21-Apr-15 8:34 
QuestionEntity framework : How to get DBcontext.ChangeTracker.Entries(of ???)) for a class known only at runtime Pin
dilkonika20-Apr-15 18:22
dilkonika20-Apr-15 18:22 
AnswerRe: Entity framework : How to get DBcontext.ChangeTracker.Entries(of ???)) for a class known only at runtime Pin
Dave Kreskowiak21-Apr-15 1:50
mveDave Kreskowiak21-Apr-15 1:50 
QuestionContinue to next step in a for..next loop only when the user press a button. Pin
dilkonika18-Apr-15 17:59
dilkonika18-Apr-15 17:59 
AnswerRe: Continue to next step in a for..next loop only when the user press a button. Pin
PIEBALDconsult18-Apr-15 18:52
mvePIEBALDconsult18-Apr-15 18:52 
GeneralRe: Continue to next step in a for..next loop only when the user press a button. Pin
dilkonika18-Apr-15 19:01
dilkonika18-Apr-15 19:01 
GeneralRe: Continue to next step in a for..next loop only when the user press a button. PinPopular
PIEBALDconsult18-Apr-15 19:21
mvePIEBALDconsult18-Apr-15 19:21 
GeneralRe: Continue to next step in a for..next loop only when the user press a button. Pin
dilkonika18-Apr-15 19:41
dilkonika18-Apr-15 19:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.