1 UI
2
3
4 Code
1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.ComponentModel;4 usingSystem.Data;5 usingSystem.Drawing;6 usingSystem.Linq;7 usingSystem.Text;8 usingSystem.Threading.Tasks;9 usingSystem.Windows.Forms;Ten One namespaceWindowsFormsApplication1 A { - Public Partial classForm1:form - { the PublicForm1 () - { - InitializeComponent (); - } + - Private voidForm1_Load (Objectsender, EventArgs e) + { A atlist<test> datas =NewList<test>(); -Datas. ADD (NewTest () {Name ="Dry", age ="1" }); - - //binding Data -Datagridview1.datasource =datas; - in } - classTest to { + Private string_name; - Private string_age; the * Public stringName $ {Panax Notoginseng Get - { the return_name; + } A the Set + { -_name =value; $ } $ } - - Public string Age the { - GetWuyi { the return_age; - } Wu - Set About { $_age =value; - } - } - } A } +}
5 effects
C#winform Datagirdview datapropertyname bind data to each column