Skip to main content
All docs
V23.2

Create a WinForms Dashboard Viewer (.NET)

  • 3 minutes to read

This tutorial describes how to create a WinForms application with the Dashboard Viewer in .NET 6 and later.

Prerequisites

Create a New Project

You can create a new .NET project in the console window or use Visual Studio’s template.

Create a New .NET Project in the Console Window

Open the console window and follow the steps below.

Create and open a new folder. The folder name is the project name.

mkdir NewWinFormsApp
cd NewWinFormsApp

Create a WinForms project:

dotnet new winforms

Create a solution file:

dotnet new sln

Add the created .NET project to this solution:

dotnet sln add NewWinFormsApp.csproj

Open the created solution in Visual Studio.

Create a New .NET Project in Visual Studio

In Visual Studio, create a new project and select Windows Forms App on the start page as the project template.

Create a new project

Note

Do not select the Windows Forms App (.NET Framework) template.

In the next dialog window, select the target framework.

Install Dashboard packages

Select Manage NuGet Packages in the invoked context menu to invoke the NuGet Package Manager.

manage-nuget-packages

Register the DevExpress NuGet feed as a package source and select it in the drop-down menu.

Install the DevExpress.Win.Dashboard.Design package (DevExpress.Win.Dashboard for projects that target .NET 6 and later).

install-nuget-package

The installed libraries are added to the project after installation is completed.

Installed NuGet libraries

Create a WinForms Dashboard Viewer

You can create the Dashboard Viewer at design time or in code when you reference the Win.Dashboard.Design package in your project. For projects that reference the DevExpress.Win.Dashboard package, the Dashboard Viewer can only be created in code.

Design Time

Drag the DashboardViewer control from the DX.22.1: Data & Analytics Toolbox tab and drop it onto the main form.

Toolbox

Click the control’s smart tag and select Dock in parent container in the invoked actions list to allow the Dashboard Viewer to fill the form.

Dock the Dashboard Viewer to the form

Runtime

To create the Dashboard Viewer at runtime, add the following code in a Form1.cs file:

using System.Windows.Forms;
using DevExpress.DashboardWin;

//...

DashboardViewer viewer = new DashboardViewer();
this.Controls.Add(viewer);
viewer.Dock = DockStyle.Fill;

Add a Dashboard

Use the DashboardViewer.LoadDashboard method to load an existing dashboard in code.

Next Steps

Create and Edit a Dashboard in Visual Studio

Create a Dashboard in Visual Studio (.NET) — Shows how to create and edit a dashboard in Visual Studio at design time.

Display the Dashboard in the WinForms Dashboard Viewer

WinForms Viewer — Describes how to prepare the DashboardViewer control to display a dashboard in a WinForms application.