Click here to Skip to main content
15,888,610 members
Home / Discussions / C#
   

C#

 
QuestionExcel: change cell color of unprotect sheet using macro. Pin
hirenkshah21-Apr-09 19:15
hirenkshah21-Apr-09 19:15 
QuestionView PDF file in winform Pin
aldo hexosa21-Apr-09 18:54
professionalaldo hexosa21-Apr-09 18:54 
AnswerRe: View PDF file in winform Pin
Giorgi Dalakishvili21-Apr-09 19:39
mentorGiorgi Dalakishvili21-Apr-09 19:39 
QuestionWriting correct code Pin
Akhilesh Yadav21-Apr-09 18:45
Akhilesh Yadav21-Apr-09 18:45 
AnswerRe: Writing correct code Pin
Perry Holman21-Apr-09 19:30
Perry Holman21-Apr-09 19:30 
GeneralRe: Writing correct code Pin
Akhilesh Yadav21-Apr-09 19:32
Akhilesh Yadav21-Apr-09 19:32 
GeneralRe: Writing correct code Pin
Mycroft Holmes21-Apr-09 20:18
professionalMycroft Holmes21-Apr-09 20:18 
AnswerRe: Writing correct code Pin
Thomas Weller21-Apr-09 20:49
Thomas Weller21-Apr-09 20:49 
Try this:

DataGridView grid = new DataGridView();

foreach(string colName in ColumnNames)
{
    grid.Columns.Add(
            ([condition]) ?
                new DataGridViewColumn() :
                new MyColumn());
} 


And btw: Don't care about performance at all, as long as you have no hard evidence (i.e. measures or customer complaints) about it. During development, you should only care about the correct functioning, behaviour and readability of your code. Use unit tests to reliably assure this.

Regards
Thomas

www.thomas-weller.de

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Programmer - an organism that turns coffee into software.


AnswerRe: Writing correct code Pin
Luc Pattyn22-Apr-09 4:39
sitebuilderLuc Pattyn22-Apr-09 4:39 
QuestionDatagridView Column Re-ordering Pin
codeprasanna21-Apr-09 18:44
codeprasanna21-Apr-09 18:44 
AnswerRe: DatagridView Column Re-ordering Pin
Mycroft Holmes21-Apr-09 20:16
professionalMycroft Holmes21-Apr-09 20:16 
QuestionFtp Linux Command in .Net Pin
Abdul Rahman Hamidy21-Apr-09 18:02
Abdul Rahman Hamidy21-Apr-09 18:02 
AnswerRe: Ftp Linux Command in .Net Pin
blackjack215023-Apr-09 2:57
blackjack215023-Apr-09 2:57 
QuestionNeed assistance with automatic install application Pin
Robert Madsen21-Apr-09 17:13
professionalRobert Madsen21-Apr-09 17:13 
AnswerRe: Need assistance with automatic install application Pin
Perry Holman21-Apr-09 19:38
Perry Holman21-Apr-09 19:38 
GeneralRe: Need assistance with automatic install application Pin
Robert Madsen24-Apr-09 16:34
professionalRobert Madsen24-Apr-09 16:34 
AnswerRe: Need assistance with automatic install application Pin
Giorgi Dalakishvili21-Apr-09 19:40
mentorGiorgi Dalakishvili21-Apr-09 19:40 
GeneralRe: Need assistance with automatic install application Pin
Robert Madsen24-Apr-09 16:30
professionalRobert Madsen24-Apr-09 16:30 
QuestionHow to click on a website when it's minimized Pin
jeanbern21-Apr-09 17:08
jeanbern21-Apr-09 17:08 
QuestionRotate printing Pin
damichab21-Apr-09 16:31
damichab21-Apr-09 16:31 
AnswerRe: Rotate printing Pin
Luc Pattyn21-Apr-09 16:54
sitebuilderLuc Pattyn21-Apr-09 16:54 
GeneralRe: Rotate printing Pin
damichab21-Apr-09 17:12
damichab21-Apr-09 17:12 
GeneralRe: Rotate printing Pin
Luc Pattyn21-Apr-09 17:42
sitebuilderLuc Pattyn21-Apr-09 17:42 
GeneralRe: Rotate printing Pin
damichab21-Apr-09 17:50
damichab21-Apr-09 17:50 
GeneralRe: Rotate printing Pin
Luc Pattyn21-Apr-09 18:02
sitebuilderLuc Pattyn21-Apr-09 18:02 

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.