Mayank Jani

Mayank Jani

  • 1.4k
  • 477
  • 38.7k

How to save formatted DataGridView cells in database?

Feb 25 2018 12:16 PM
Dear Members,
Greetings of the day...
I am learning C# WinApp. I have a DataGridView and a CommandButton on a form. the DGV contains a column and few cells in it. When I click on any cell, the Font DialogBox opens and I choose any font with style like Bold, Italics or Underline etc. By pressing OK button of the Font DialogBox, the font and style assigns to the cell of the DGV. I have write the below code for that...
 private void dgvPrintSettings_CellClick(object sender, DataGridViewCellEventArgs e)
dgvPrintSettings.Rows[dgvPrintSettings.CurrentRow.Index].Cells[dgvPrintSettings.CurrentCell.ColumnIndex].Style.Font = fontDialog1.Font;
this way, I can have each cell with different font and style but...
I don't know how to save these details to the DataTable? I want these details to be saved in a dt for later use say, when I go back or reload the form I want to see the exact details what I have been saved in dt.
I have design the table with fields like PFont, PSize, PBold, PItalics etc. so I can save all the font details for all the cell in the DGV.
Please help me out with how to save the details. If you have any other way to save the details (like my table fields) you're most welcome.
Please note that this is C# WinApp and MS Access as database.
Thank You.
Mayank Jani.

Brought to you by:

Answers (10)