Mazin
Mazin

Reputation: 43

How to add DataGridView control using VS2015?

I am totally new to programming in c# and have no previous experience with Object Oriented programming. I am teaching myself, so please I have many questions. I created a simple array that takes information from (STEP Text file) and displays it in a TextBox, now I am trying to put this information in Grid (like table) instead of showing them in a TextBox. I found Grid and Datagrid in the Toolbox window, but couldn't find DataGridView. I am using Visual Studio 2015. I would like to know:

  1. How can I add DataGridView to my project?
  2. Is there a simple code to put the information in a grid?

Since I am a beginner, please, be patient with me.

Upvotes: 0

Views: 359

Answers (1)

haku
haku

Reputation: 4505

The reason is DataGridView is Windows Forms control and is available in Windows Forms project type only. You wont be able to use that in your WPF project. The equivalent in WPF is DataGrid.

As for the part regarding adding information in a grid, you will have to set the DataContext property of the DataGrid. For learning WPF, I would recommend to check out the two websites below: https://wpftutorial.net/DataGrid.html

http://www.blackwasp.co.uk/WPFDataGrid.aspx

Upvotes: 2

Related Questions