How to Use DataGrid for Editing & Deleting
- 1). Open the Visual Studio 2010 software by clicking on its application icon. After it finishes loading, select "File" followed by "New" and "Project." A window appears. Click "Visual C#" from the left-hand column, and then select "Windows Form Application" in the right-hand side of the window. A new Windows Form project is created, and a blank form appears in the main editor window.
- 2). Look for the panel named "Toolbox," which can be on either the left or right side of the main editor window. The "Toolbox" lists all of the different graphical components that can be added to the Windows Form, including "DataGridView."
- 3). Locate and click on the item "DataGridView" in the "Toolbox." Drag the mouse cursor over to the Windows Form, and release the mouse button to place the "DataGridView."
- 4). Click on the small black triangle, which is located to the upper-right side of the "DataGridView" component. A menu opens. Click on "Add Column" to add a column.
- 5). Execute the program by pressing the green "Play" button. A Windows Form appears, and it displays a "DataGridView" with a single column.
- 6). Click on any cell in the column. Write some text. Another row below this cell will be created automatically.
- 7). Click on any cell with contents in it to edit it. The cell acts as a simple text editor, allowing you to add, remove or otherwise change its contents.
- 8). Select any row, and then press the "Del" key on the keyboard to completely delete it.