Sending Datagridview to email

后端 未结 3 614
无人及你
无人及你 2021-01-07 03:23

i made a code that i can send an email to gmail.com with c# and it is working very well. Now i want to put my datagridview1 in the email body and send it. Somone can show me

3条回答
  •  [愿得一人]
    2021-01-07 04:09

    The DataGridView is a WinForm-Control (or: an object) in the first place. What you could do is, for example:

    1. walk through all data items of the dgv and create a table or list to set this to the email body.

    2. you could export the whole object via serialization to xml/json, if you want to export not only the content but the whole object structure.

    3. You also can add the serialized object as an attachment to the email.

提交回复
热议问题