Dim dic As New Dictionary(Of String, String) dic.Add("111", "") dic.Add("32", "") For Each k In dic.Keys ... Next
这里这个k不用先dim下什么就可以用呵?不会有什么意外的? 另外我这个k是文件路径,我想作为邮件附件的,我这样: For Each k In dic.Keys MailMessage.Attachments.Add(k) Next 它报错,提示说:类型string的值无法转换为system.net.mail.attchment .要怎么办呢? 意思是说字符串无法转换为附件? 可是我直接用字符串比如MailMessage.Attachments.Add("c:\111.txt")是可以的.
Dim dic As New Dictionary(Of String, String)
dic.Add("111", "")
dic.Add("32", "")
For Each k In dic.Keys
...
Next
另外我这个k是文件路径,我想作为邮件附件的,我这样:
For Each k In dic.Keys
MailMessage.Attachments.Add(k)
Next
它报错,提示说:类型string的值无法转换为system.net.mail.attchment .要怎么办呢? 意思是说字符串无法转换为附件? 可是我直接用字符串比如MailMessage.Attachments.Add("c:\111.txt")是可以的.
要怎么办呢?求大侠们帮看下.
多谢!!