1

I am new to C#. I am currently learning how to write a window form application. I want to export some of my data from my form to an Excel file.

I am wondering what is the best way to approach this problem?

I have looked through many tutorial site and YouTube video and most of them suggest to use a data grid view. One thing I notice is that datagridview work well with simple GUI layout like the textbox.

However, what if I have some other complicated components such as a checkbox and a comboBox in my form?

Data grid view seems not the best option to do it. Are there any other better solutions to this case?

pnuts
  • 58,317
  • 11
  • 87
  • 139
RedRocket
  • 1,643
  • 7
  • 28
  • 51
  • 1
    You're not looking for the "best way", but for any way. Did you do research on how to write an Excel file? Plenty of examples on the web. With what part specifically are you having trouble? – CodeCaster Sep 14 '15 at 10:19

1 Answers1

2

The approach depends on the desired result. As far as I know, Excel is able to import from a delimiter-separated text file. Depending on the context, it might be a valid approach to programmatically write to a text file which is then read by Excel.

Codor
  • 17,447
  • 9
  • 29
  • 56
  • Thanks, I will look into it, is it the same if you grab the data from the SQL server and then export it to excel file? – RedRocket Sep 15 '15 at 01:36