C# DataGridView – Add Text From Textbox to DataGridView On Button Click – Programming, Pseudocode Example, C# Programming Example
Windows Form

C# DataGridView – Add Text From Textbox to DataGridView On Button Click

In this tutorial I’ll show you how to add data from textbox into DataGridView. Firstly I designed the Windows Form Application as following the picture.

I added three textboxes, a button and a gridview. I named textboxs as txtName, txtLastName, txtAge. Also I named the button and the gridview as btnAdd, dataGridViewList.

If you finish  the design just double click the btnAdd (button). Now I will appreciate any ideas or solutions on how can we possibly get the values from textboxes on button click

I defined the names of columns in Form1() metod. Form1 method is constructor method of this class and project.

From1() Method:

btnAdd Click:

 

And AddRow Method: (You may aslo add in the btnAdd)

Click HERE to download the example

All Codes:

Output:

 

1 Comment

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.