如何在Windows窗体应用程序中将Gridview放入带有Vb的电子邮件正文中? [英] How Do I Put A Gridview Into An Email Body With Vb In A Windows Forms App?

查看:96
本文介绍了如何在Windows窗体应用程序中将Gridview放入带有Vb的电子邮件正文中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

喂!我只需要能够将gridview放入电子邮件正文,打开发送它的电子邮件客户端,并在客户端打开一个新的电子邮件,其中包含bodyview。我可以用VB编写代码,但我在网上找到的只是使用html的asp.net。我可以将我的gridview转换为html文件,但是idk从哪里开始。请帮助哈哈。我所拥有的gridview也来自ComponentOne,而不是那么重要。我觉得应该有一个非常简单的方法来做到这一点。任何建议将不胜感激。





更新。



我的主要问题是我可以将我的gridview转换为html文件,但我不知道如何将它加载到电子邮件正文中。当我说文件时,我的意思是我已将gridview输出到计算机上的文件夹中的.html。我可以打开它,它显示gridview。我需要在电子邮件正文中使用该表,而不是作为附件。

Hey! I Just need to be able to put in a gridview into an email body, open the email client that would send it, and in the client it opens a new email with the gridview in the body. I can code in VB, but all I am finding online is with asp.net using html. I can convert my gridview into an html file but idk where to go from there. PLEASE HELP lol. The gridview I have is also from ComponentOne, not that that matters. I feel like there should be a pretty simple way to do this. Any advice would be greatly appreciated.


UPDATE.

My main problem is that I can convert my gridview into an html FILE, but I don't know how to load it into the email body. When I say file I mean I have outputted the gridview to a .html in a folder on my computer. I can open it and it shows the gridview. I need that table in the body of the email, not as an attachment.

推荐答案

将网格视图表示为HTML(不管它是什么;它是ASP.NET ,你的网格视图已经是HTML表格)并发送内容类型为text / html的消息,如果你设置了这个属性,它将自动完成:

https://msdn.microsoft.com/en-us/library/system .net.mail.mailmessage.isbodyhtml(v = vs.110).aspx [ ^ ],

https://msdn.microsoft.com/en-us/library/system.net.mail .mailmessage%28v = vs.110%29.aspx [ ^ ]。



或者,您可以使用邮件部分或替代视图并使用此内容类型仅适用于视图或部分:

https://msdn.microsoft.com/en-us/library/system.net.mail.alternateview(v = vs.110).aspx [ ^ ],

https:// msdn.microsoft.com/en-us/library/system.net.mail.attachment(v=vs.110).aspx [ ^ ]。



附件(如上所述)可以有不同的 ContentDisposition 属性,因此您可以指示邮件客户端显示部分内联,或使其成为可下载或单独查看的附件,等等。请参阅:

https://msdn.microsoft.com/en-us/library/system.net.mail.attachment.contentdisposition%28v=vs.110%29.aspx [ ^ ],

https://msdn.microsoft.com/en-us/library/system.net.mime.contentdisposition%28v=vs.110%29.aspx [ ^ ]。



-SA
Represent your grid view as HTML (whatever it is; it this is ASP.NET, you grid view is already HTML table) and send the message with Content-type "text/html", which will be automatically done if you set this property:
https://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.isbodyhtml(v=vs.110).aspx[^],
https://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage%28v=vs.110%29.aspx[^].

Alternatively, you can use mail parts or alternative views and use this content type only for a view or a part:
https://msdn.microsoft.com/en-us/library/system.net.mail.alternateview(v=vs.110).aspx[^],
https://msdn.microsoft.com/en-us/library/system.net.mail.attachment(v=vs.110).aspx[^].

Attachments (mentioned above) can have different ContentDisposition properties, so you can instruct the mail client to show the part inline, or make it as downloadable or separately-viewed attachment, and so on. Please see:
https://msdn.microsoft.com/en-us/library/system.net.mail.attachment.contentdisposition%28v=vs.110%29.aspx[^],
https://msdn.microsoft.com/en-us/library/system.net.mime.contentdisposition%28v=vs.110%29.aspx[^].

—SA


这篇关于如何在Windows窗体应用程序中将Gridview放入带有Vb的电子邮件正文中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆