Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
title: Create an Unbound DataGridView Control
title: How to Create an Unbound Windows Forms DataGridView Control

description: Populate an unbound Windows Forms DataGridView Control programmatically and display a small amount of data in a table format without binding it to a data source
Comment on lines +2 to +4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kirupap Right after I merged I noticed this blank line. Generally there aren't any blank lines between metadata items. Can you fix these up?


ms.date: "03/30/2017"
dev_langs:
- "csharp"
Expand All @@ -11,18 +14,21 @@ helpviewer_keywords:
ms.assetid: b5d4b47d-9a28-4d88-9dba-0a3c90fba71d
---
# How to: Create an Unbound Windows Forms DataGridView Control
The following code example demonstrates how to populate a <xref:System.Windows.Forms.DataGridView> control programmatically without binding it to a data source. This is useful when you have a small amount of data that you want to display in a table format.

The following code example demonstrates how to populate a <xref:System.Windows.Forms.DataGridView> control programmatically without binding it to a data source. This is useful when you have a small amount of data that you want to display in a table format.

For a complete explanation of this code example, see [Walkthrough: Creating an Unbound Windows Forms DataGridView Control](walkthrough-creating-an-unbound-windows-forms-datagridview-control.md).
For a complete explanation of this code example, see [Walkthrough: Creating an Unbound Windows Forms DataGridView Control](walkthrough-creating-an-unbound-windows-forms-datagridview-control.md).

## Example

## Example
[!code-csharp[System.Windows.Forms.DataGridViewSimpleUnbound#00](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewSimpleUnbound/CS/simpleunbound.cs#00)]
[!code-vb[System.Windows.Forms.DataGridViewSimpleUnbound#00](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewSimpleUnbound/VB/simpleunbound.vb#00)]
[!code-vb[System.Windows.Forms.DataGridViewSimpleUnbound#00](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewSimpleUnbound/VB/simpleunbound.vb#00)]

## Compiling the Code
This example requires:
## Compiling the Code

This example requires:

- References to the System, System.Drawing, and System.Windows.Forms assemblies.
- References to the System, System.Drawing, and System.Windows.Forms assemblies.

## See also

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
title: Create an Unbound DataGridView Control
title: Walkthrough to Creating an Unbound Windows Forms DataGridView Control

description: You can create an Unbound Windows Forms DataGridView Control and display a small amount of data without binding it to a data source

Comment on lines +3 to +5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

ms.date: "03/30/2017"
dev_langs:
- "csharp"
Expand All @@ -13,13 +16,14 @@ helpviewer_keywords:
ms.assetid: 5a8d6afa-1b4b-4b24-8db8-501086ffdebe
---
# Walkthrough: Creating an Unbound Windows Forms DataGridView Control

You may frequently want to display tabular data that does not originate from a database. For example, you may want to show the contents of a two-dimensional array of strings. The <xref:System.Windows.Forms.DataGridView> class provides an easy and highly customizable way to display data without binding to a data source. This walkthrough shows how to populate a <xref:System.Windows.Forms.DataGridView> control and manage the addition and deletion of rows in "unbound" mode. By default, the user can add new rows. To prevent row addition, set the <xref:System.Windows.Forms.DataGridView.AllowUserToAddRows%2A> property is `false`.

To copy the code in this topic as a single listing, see [How to: Create an Unbound Windows Forms DataGridView Control](how-to-create-an-unbound-windows-forms-datagridview-control.md).

## Creating the Form

#### To use an unbound DataGridView control
### To use an unbound DataGridView control

1. Create a class that derives from <xref:System.Windows.Forms.Form> and contains the following variable declarations and `Main` method.

Expand Down Expand Up @@ -64,16 +68,18 @@ You may frequently want to display tabular data that does not originate from a d
[!code-csharp[System.Windows.Forms.DataGridViewSimpleUnbound#10](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewSimpleUnbound/CS/simpleunbound.cs#10)]
[!code-vb[System.Windows.Forms.DataGridViewSimpleUnbound#10](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewSimpleUnbound/VB/simpleunbound.vb#10)]

## Testing the Application
## Testing the Application

You can now test the form to make sure it behaves as expected.

#### To test the form
### To test the form

- Press F5 to run the application.

You will see a <xref:System.Windows.Forms.DataGridView> control that displays the songs listed in `PopulateDataGridView`. You can add new rows with the **Add Row** button, and you can delete selected rows with the **Delete Row** button. The unbound <xref:System.Windows.Forms.DataGridView> control is the data store, and its data is independent of any external source, such as a <xref:System.Data.DataSet> or an array.

## Next Steps
## Next Steps

This application gives you a basic understanding of the <xref:System.Windows.Forms.DataGridView> control's capabilities. You can customize the appearance and behavior of the <xref:System.Windows.Forms.DataGridView> control in several ways:

- Change border and header styles. For more information, see [How to: Change the Border and Gridline Styles in the Windows Forms DataGridView Control](change-the-border-and-gridline-styles-in-the-datagrid.md).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
title: "How-to: Alter the Typography of Text"
title: How to Alter the Typography of Text

description: To alter the telegraphy of text, set the telegraphy attribute. You can set the typographic property of text programmatically. You can see how altered and default telegraphy properties of text render on screen each with an example.

Comment on lines +3 to +5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

ms.date: "03/30/2017"
dev_langs:
- "csharp"
Expand All @@ -10,24 +13,27 @@ helpviewer_keywords:
ms.assetid: 19a3b49b-60a2-4c11-a786-e26b4c965588
---
# How-to: Alter the Typography of Text
The following example shows how to set the <xref:System.Windows.Documents.TextElement.Typography%2A> attribute, using <xref:System.Windows.Documents.Paragraph> as the example element.

The following example shows how to set the <xref:System.Windows.Documents.TextElement.Typography%2A> attribute, using <xref:System.Windows.Documents.Paragraph> as the example element.

## Example
[!code-xaml[TextElementSnippets#_TextElement_TypogXAML](~/samples/snippets/csharp/VS_Snippets_Wpf/TextElementSnippets/CSharp/Window1.xaml#_textelement_typogxaml)]
## Example 1: To show how altered and default typographic properties of text render on screen

[!code-xaml[TextElementSnippets#_TextElement_TypogXAML](~/samples/snippets/csharp/VS_Snippets_Wpf/TextElementSnippets/CSharp/Window1.xaml#_textelement_typogxaml)]

The following figure shows how this example renders.
The following figure shows how this example renders.

![Screenshot: Text with altered typography](./media/textelement-typog.png "TextElement_Typog")
![Screenshot: Text element with altered typography](./media/textelement-typog.png "TextElement_Typog")

In contrast, the following figure shows how a similar example with default typographic properties renders.
In contrast, the following figure shows how a similar example with default typographic properties renders.

![Screenshot: Text with altered typography](./media/textelement-typog-default.png "TextElement_Typog_Default")
![Screenshot: Text element with default typography](./media/textelement-typog-default.png "TextElement_Typog_Default")

## Example
The following example shows how to set the <xref:System.Windows.Controls.TextBox.Typography%2A> property programmatically.
## Example 2: To show how to set typographic property of text programmatically

The following example shows how to set the <xref:System.Windows.Controls.TextBox.Typography%2A> property programmatically.

[!code-csharp[TextElementSnippets#_TextElement_Typog](~/samples/snippets/csharp/VS_Snippets_Wpf/TextElementSnippets/CSharp/Window1.xaml.cs#_textelement_typog)]
[!code-vb[TextElementSnippets#_TextElement_Typog](~/samples/snippets/visualbasic/VS_Snippets_Wpf/TextElementSnippets/visualbasic/window1.xaml.vb#_textelement_typog)]
[!code-vb[TextElementSnippets#_TextElement_Typog](~/samples/snippets/visualbasic/VS_Snippets_Wpf/TextElementSnippets/visualbasic/window1.xaml.vb#_textelement_typog)]

## See also

Expand Down