Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0242bc1
updating unique titles to topics for us1889327
kirupap Nov 26, 2021
ad120e7
updating unique titles to topics for us1889327
kirupap Nov 26, 2021
86a3177
updating unique level 2 headings for us1889327
kirupap Nov 26, 2021
30fcd52
Updating unique titles to topics for US1889327
kirupap Nov 29, 2021
ac74b83
Fixing unique titles in topics for US1889327
kirupap Dec 2, 2021
4f57f68
Fixing unique titles for topics for us1889327
kirupap Dec 3, 2021
2f2aa25
Fixing unique titles for topics for us1889327
kirupap Dec 3, 2021
69258dc
updating unique titles in topics for US1889327
kirupap Dec 3, 2021
64becc4
updating unique titles in topics for US1889327
kirupap Dec 3, 2021
c99e9f5
Fixing Duplicate Level 2 headings in this topic for US1889327
kirupap Dec 3, 2021
492e871
Fixing unique level 2 headings in topics for US1889327
kirupap Dec 3, 2021
6bf985c
Updating unique titles and level 2 headings in topics for US1889327
kirupap Dec 3, 2021
2b986b1
Merge branch 'main' into kirupap-duplicate-titles-1
kirupap Dec 3, 2021
7a23021
fixing conflicts and markdown errors
kirupap Dec 3, 2021
7410ca8
fixing conflicts and markdown errors
kirupap Dec 3, 2021
08ea718
fixing conflicts and markdown errors
kirupap Dec 3, 2021
cf60350
Update how-to-alter-the-typography-of-text.md
kirupap Dec 3, 2021
e405f2e
Update how-to-alter-the-typography-of-text.md
kirupap Dec 3, 2021
a8eb67c
markdown errors
kirupap Dec 4, 2021
a7955ee
fixing trailing spaces
kirupap Dec 4, 2021
cc17f22
fixing merging conflict
kirupap Dec 4, 2021
fa848d4
Fixing markdown error
kirupap Dec 5, 2021
1b884a6
Fixing markdown error
kirupap Dec 5, 2021
28d0eca
fixing peer review comments
kirupap Dec 6, 2021
705b014
fixing peer review comments
kirupap Dec 6, 2021
e12d950
Fixing conflicts in PR for US1889327
kirupap Dec 6, 2021
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,6 +1,5 @@
---
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

ms.date: "03/30/2017"
Expand All @@ -15,9 +14,9 @@ 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

Expand All @@ -26,13 +25,13 @@ The following code example demonstrates how to populate a <xref:System.Windows.F

## Compiling the Code

This example requires:
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

- <xref:System.Windows.Forms.DataGridView>
- [Walkthrough: Creating an Unbound Windows Forms DataGridView Control](walkthrough-creating-an-unbound-windows-forms-datagridview-control.md)
- [Walk-through: Creating an Unbound Windows Forms DataGridView Control](walkthrough-creating-an-unbound-windows-forms-datagridview-control.md)
- [Displaying Data in the Windows Forms DataGridView Control](displaying-data-in-the-windows-forms-datagridview-control.md)
- [Data Display Modes in the Windows Forms DataGridView Control](data-display-modes-in-the-windows-forms-datagridview-control.md)
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ms.assetid: 8025247a-2de4-4d86-b8ab-a8cb8aeab2ea
---
# How to: Run Procedures at Set Intervals with the Windows Forms Timer Component

You might sometimes want to create a procedure that runs at specific time intervals until a loop has finished or that runs when a set time interval has elapsed. The <xref:System.Windows.Forms.Timer> component makes such a procedure possible.
The <xref:System.Windows.Forms.Timer> component makes both procedures possible. You can create a procedure that runs at specific time intervals until a loop has finished. You can also create a procedure that runs when a set time interval has elapsed. See Examples 1 and 2 below.

This component is designed for a Windows Forms environment. If you need a timer that is suitable for a server environment, see [Introduction to Server-Based Timers](/previous-versions/visualstudio/visual-studio-2008/tb9yt5e6(v=vs.90)).

Expand All @@ -26,20 +26,20 @@ You might sometimes want to create a procedure that runs at specific time interv

## To run a procedure at set intervals with the Timer component

1. Add a <xref:System.Windows.Forms.Timer> to your form. See the following Example section for an illustration of how to do this programmatically. Visual Studio also has support for adding components to a form. Also see [How to: Add Controls Without a User Interface to Windows Forms](how-to-add-controls-without-a-user-interface-to-windows-forms.md).
1. Add a <xref:System.Windows.Forms.Timer> to your form. See Example 3: To show how to set typographic property of text programmatically [How-to: Alter the Typography of Text](../../wpf/advanced/how-to-alter-the-typography-of-text.md). Visual Studio also has support for adding components to a form. See [How to: Add Controls Without a User Interface to Windows Forms](how-to-add-controls-without-a-user-interface-to-windows-forms.md).

2. Set the <xref:System.Windows.Forms.Timer.Interval%2A> property (in milliseconds) for the timer. This property determines how much time will pass before the procedure is run again.
1. Set the <xref:System.Windows.Forms.Timer.Interval%2A> property (in milliseconds) for the timer. This property determines how much time will pass before the procedure is run again.

> [!NOTE]
> The more often a timer event occurs, the more processor time is used in responding to the event. This can slow down overall performance. Do not set a smaller interval than you need.

3. Write appropriate code in the <xref:System.Windows.Forms.Timer.Tick> event handler. The code you write in this event will run at the interval specified in the <xref:System.Windows.Forms.Timer.Interval%2A> property.
1. Write appropriate code in the <xref:System.Windows.Forms.Timer.Tick> event handler. The code you write in this event will run at the interval specified in the <xref:System.Windows.Forms.Timer.Interval%2A> property.

4. Set the <xref:System.Windows.Forms.Timer.Enabled%2A> property to `true` to start the timer. The <xref:System.Windows.Forms.Timer.Tick> event will begin to occur, running your procedure at the set interval.
1. Set the <xref:System.Windows.Forms.Timer.Enabled%2A> property to `true` to start the timer. The <xref:System.Windows.Forms.Timer.Tick> event will begin to occur, running your procedure at the set interval.

5. At the appropriate time, set the <xref:System.Windows.Forms.Timer.Enabled%2A> property to `false` to stop the procedure from running again. Setting the interval to `0` does not cause the timer to stop.
1. At the appropriate time, set the <xref:System.Windows.Forms.Timer.Enabled%2A> property to `false` to stop the procedure from running again. Setting the interval to `0` does not cause the timer to stop.

## Example
## Example 1: Shows how to track the time of day in oe-second increments

This first code example tracks the time of day in one-second increments. It uses a <xref:System.Windows.Forms.Button>, a <xref:System.Windows.Forms.Label>, and a <xref:System.Windows.Forms.Timer> component on a form. The <xref:System.Windows.Forms.Timer.Interval%2A> property is set to 1000 (equal to one second). In the <xref:System.Windows.Forms.Timer.Tick> event, the label's caption is set to the current time. When the button is clicked, the <xref:System.Windows.Forms.Timer.Enabled%2A> property is set to `false`, stopping the timer from updating the label's caption. The following code example requires that you have a form with a <xref:System.Windows.Forms.Button> control named `Button1`, a <xref:System.Windows.Forms.Timer> control named `Timer1`, and a <xref:System.Windows.Forms.Label> control named `Label1`.

Expand Down Expand Up @@ -145,7 +145,7 @@ private:
}
```

## Example
## Example 2: Shows how to run a procedure every 600 milliseconds until a loop has finished

This second code example runs a procedure every 600 milliseconds until a loop has finished. The following code example requires that you have a form with a <xref:System.Windows.Forms.Button> control named `Button1`, a <xref:System.Windows.Forms.Timer> control named `Timer1`, and a <xref:System.Windows.Forms.Label> control named `Label1`.

Expand Down
Loading