GridColumnStylesCollection.AddRange(DataGridColumnStyle[]) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds an array of column style objects to the collection.
public:
void AddRange(cli::array <System::Windows::Forms::DataGridColumnStyle ^> ^ columns);
public void AddRange (System.Windows.Forms.DataGridColumnStyle[] columns);
member this.AddRange : System.Windows.Forms.DataGridColumnStyle[] -> unit
Public Sub AddRange (columns As DataGridColumnStyle())
Parameters
- columns
- DataGridColumnStyle[]
An array of DataGridColumnStyle objects to add to the collection.
Examples
The following code example creates an array of DataGridColumnStyle objects, and uses the AddRange method to add the array to the GridColumnStylesCollection.
void AddStyleRange()
{
// Create two DataGridColumnStyle objects.
DataGridColumnStyle^ col1 = gcnew DataGridTextBoxColumn;
col1->MappingName = "FirstName";
DataGridColumnStyle^ col2 = gcnew DataGridBoolColumn;
col2->MappingName = "Current";
// Create an array and use AddRange to add to collection.
array<DataGridColumnStyle^>^cols = {col1,col2};
dataGrid1->TableStyles[ 0 ]->GridColumnStyles->AddRange( cols );
}
private void AddStyleRange()
{
// Create two DataGridColumnStyle objects.
DataGridColumnStyle col1 = new DataGridTextBoxColumn();
col1.MappingName = "FirstName";
DataGridColumnStyle col2 = new DataGridBoolColumn();
col2.MappingName = "Current";
// Create an array and use AddRange to add to collection.
DataGridColumnStyle[] cols = new DataGridColumnStyle[2] {col1, col2};
dataGrid1.TableStyles[0].GridColumnStyles.AddRange(cols);
}
Private Sub AddStyleRange()
' Create two DataGridColumnStyle objects.
Dim col1 As New DataGridTextBoxColumn()
col1.MappingName = "FirstName"
Dim col2 As New DataGridBoolColumn()
col2.MappingName = "Current"
' Create an array and use AddRange to add to collection.
Dim cols() As DataGridColumnStyle = {col1, col2}
dataGrid1.TableStyles(0).GridColumnStyles.AddRange(cols)
End Sub
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET