Click here to Skip to main content
15,921,577 members
Home / Discussions / C#
   

C#

 
GeneralRe: Random in C# Pin
alee15.10.886-Apr-06 9:07
alee15.10.886-Apr-06 9:07 
GeneralRe: Random in C# Pin
Jakob Farian Krarup6-Apr-06 9:37
Jakob Farian Krarup6-Apr-06 9:37 
QuestionToolStripRenderer Pin
vishalkarlay6-Apr-06 6:49
vishalkarlay6-Apr-06 6:49 
AnswerRe: ToolStripRenderer Pin
Judah Gabriel Himango6-Apr-06 6:56
sponsorJudah Gabriel Himango6-Apr-06 6:56 
QuestionHow to declare virtual Columns Pin
mrkeivan6-Apr-06 6:20
mrkeivan6-Apr-06 6:20 
AnswerRe: How to declare virtual Columns Pin
Office Lineman6-Apr-06 8:42
Office Lineman6-Apr-06 8:42 
GeneralRe: How to declare virtual Columns Pin
mrkeivan6-Apr-06 9:11
mrkeivan6-Apr-06 9:11 
AnswerRe: How to declare virtual Columns Pin
Office Lineman6-Apr-06 9:30
Office Lineman6-Apr-06 9:30 
Even when I use data-bound columns, I almost always make my own columns because there are usually columns in my table that I don't want to be displayed--just there for support data and to composite for virtual columns.

When I make columns this way, I can set data-bound and virtual columns' header texts the same way:

private void InitDGV ()
{
  int idx;
  
  m_dgvDisplay.AutoGenerateColumns = false;
  
  // A virtual column designed to show icons.
  // Save the column index to use later in OnCellFormatting().
  DataGridViewImageColumn imgCol = new DataGridViewImageColumn();
  imgCol.Name = "Status";
  imgCol.HeaderText = "Status";
  imgCol.SortMode = DataGridViewColumnSortMode.NotSortable;
  idx = m_dgvDisplay.Columns.Add(imgCol);
  m_idxStatus = idx;
  
  // Bound to the "Name" column from the table
  idx = m_dgvDisplay.Columns.Add("PlayerName", "Player Name");
  m_dgvDisplay.Columns[idx].DataPropertyName = "Name";
  
  // Bound to the "Address" column from the table
  idx = m_dgvDisplay.Columns.Add("Address", "Address");
  m_dgvDisplay.Columns[idx].DataPropertyName = "Address";
  
  // Bound to the "City" column from the table, the "long" way
  DataGridViewTextBoxColumn cityCol = new DataGridViewTextBoxColumn();
  cityCol.Name = "City";
  cityCol.HeaderText = "City";
  cityCol.DataPropertyName = "City";
  m_dgvDisplay.Columns.Add(cityCol);
  
  // More columns added
  ...
  
  // Bind the grid to the table, where m_bsData is a
  // BindingSource bound to the table's default view.
  m_dgvDisplay.DataSource = m_bsData;
}


--
I've killed again, haven't I?
QuestionListBox problem Pin
Ready4u6-Apr-06 6:09
Ready4u6-Apr-06 6:09 
AnswerRe: load + save ADO.NET and c# Pin
Judah Gabriel Himango6-Apr-06 5:40
sponsorJudah Gabriel Himango6-Apr-06 5:40 
Questionsql command + datagridView Problem Pin
mrkeivan6-Apr-06 5:14
mrkeivan6-Apr-06 5:14 
Questiondbf database files import net2.0 Pin
hpetriffer6-Apr-06 4:44
hpetriffer6-Apr-06 4:44 
QuestionDataGrid in .net 1.1 and 2.0 ??? Pin
amin_behzadi6-Apr-06 4:41
professionalamin_behzadi6-Apr-06 4:41 
AnswerRe: DataGrid in .net 1.1 and 2.0 ??? Pin
NeelV7-Apr-06 2:49
NeelV7-Apr-06 2:49 
QuestionMoving files programatically Pin
naglbitur6-Apr-06 4:14
naglbitur6-Apr-06 4:14 
AnswerRe: Moving files programatically Pin
Judah Gabriel Himango6-Apr-06 4:28
sponsorJudah Gabriel Himango6-Apr-06 4:28 
GeneralRe: Moving files programatically Pin
naglbitur6-Apr-06 5:09
naglbitur6-Apr-06 5:09 
GeneralRe: Moving files programatically Pin
Judah Gabriel Himango6-Apr-06 5:16
sponsorJudah Gabriel Himango6-Apr-06 5:16 
QuestionDirectory listing Pin
wistiti56-Apr-06 3:51
wistiti56-Apr-06 3:51 
AnswerRe: Directory listing Pin
Judah Gabriel Himango6-Apr-06 4:37
sponsorJudah Gabriel Himango6-Apr-06 4:37 
QuestionTreeView dilema. Please Help! Pin
zaboboa6-Apr-06 3:43
zaboboa6-Apr-06 3:43 
AnswerRe: TreeView dilema. Please Help! Pin
Judah Gabriel Himango6-Apr-06 4:46
sponsorJudah Gabriel Himango6-Apr-06 4:46 
GeneralRe: TreeView dilema. Please Help! Pin
zaboboa6-Apr-06 5:22
zaboboa6-Apr-06 5:22 
GeneralRe: TreeView dilema. Please Help! Pin
Judah Gabriel Himango6-Apr-06 5:32
sponsorJudah Gabriel Himango6-Apr-06 5:32 
QuestionProgramming windows form in .NET Pin
bluehai6-Apr-06 3:26
bluehai6-Apr-06 3:26 

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.