简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM