What did VB replace the function “Set” with?

前端 未结 3 1718
慢半拍i
慢半拍i 2020-12-19 02:43

I\'ve found several aspx codes for forms which include the use of a \"Set\" function. When I try them out on the hosting server, I get an error message that \"Set is no lon

3条回答
  •  無奈伤痛
    2020-12-19 03:21

    Some things to remember for .Net:

    • NEVER use Server.CreateObject() in .Net code. Ever.
    • NEVER Dim a variable without giving it an explicit type. Except for new Option Infer linq types
    • NEVER use the Set keyword. Except when defining a property.

    In fact, in .Net you can get rid probably of the CDONTS dependancy entirely, as .Net has a built-in mail support:

    Dim smtp As New System.Net.SmtpClient()
    Dim message As New System.Net.MailMessage(EmailFrom, EmailTo, Subject, Body)
    smtp.Send(message)
    

提交回复
热议问题