⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmain.vb

📁 VB.NET - NET Framework - How-To Send Mai VB.NET 发送邮件的示例代码
💻 VB
📖 第 1 页 / 共 5 页
字号:
'Copyright (C) 2002 Microsoft Corporation
'All rights reserved.
'THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
'EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF 
'MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.

'Requires the Trial or Release version of Visual Studio .NET Professional (or greater).

Option Strict On
Imports System.Web.Mail
Imports System.Text
Imports System.ServiceProcess

Public Class frmMain
    Inherits System.Windows.Forms.Form

    ' For use with the WndProc override routine
    Dim WM_SYSCOMMAND As Integer = &H112
    Dim SC_CLOSE As Integer = &HF060

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

        ' So that we only need to set the title of the application once,
        ' we use the AssemblyInfo class (defined in the AssemblyInfo.vb file)
        ' to read the AssemblyTitle attribute.
        Dim ainfo As New AssemblyInfo()

        Me.Text = ainfo.Title
        Me.mnuAbout.Text = String.Format("&About {0} ...", ainfo.Title)

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents mnuMain As System.Windows.Forms.MainMenu
    Friend WithEvents mnuFile As System.Windows.Forms.MenuItem
    Friend WithEvents mnuExit As System.Windows.Forms.MenuItem
    Friend WithEvents mnuHelp As System.Windows.Forms.MenuItem
    Friend WithEvents mnuAbout As System.Windows.Forms.MenuItem
    Friend WithEvents btnSend As System.Windows.Forms.Button
    Friend WithEvents lblFrom As System.Windows.Forms.Label
    Friend WithEvents lblTo As System.Windows.Forms.Label
    Friend WithEvents lblSubject As System.Windows.Forms.Label
    Friend WithEvents lblBody As System.Windows.Forms.Label
    Friend WithEvents lblBCC As System.Windows.Forms.Label
    Friend WithEvents lblCC As System.Windows.Forms.Label
    Friend WithEvents erpEmailAddresses As System.Windows.Forms.ErrorProvider
    Friend WithEvents txtFrom As System.Windows.Forms.TextBox
    Friend WithEvents txtTo As System.Windows.Forms.TextBox
    Friend WithEvents txtSubject As System.Windows.Forms.TextBox
    Friend WithEvents txtBody As System.Windows.Forms.TextBox
    Friend WithEvents txtCC As System.Windows.Forms.TextBox
    Friend WithEvents txtBCC As System.Windows.Forms.TextBox
    Friend WithEvents cboPriority As System.Windows.Forms.ComboBox
    Friend WithEvents btnBrowse As System.Windows.Forms.Button
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents odlgAttachment As System.Windows.Forms.OpenFileDialog
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents lstAttachments As System.Windows.Forms.ListBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmMain))
        Me.mnuMain = New System.Windows.Forms.MainMenu()
        Me.mnuFile = New System.Windows.Forms.MenuItem()
        Me.mnuExit = New System.Windows.Forms.MenuItem()
        Me.mnuHelp = New System.Windows.Forms.MenuItem()
        Me.mnuAbout = New System.Windows.Forms.MenuItem()
        Me.btnSend = New System.Windows.Forms.Button()
        Me.txtFrom = New System.Windows.Forms.TextBox()
        Me.lblFrom = New System.Windows.Forms.Label()
        Me.lblTo = New System.Windows.Forms.Label()
        Me.lblSubject = New System.Windows.Forms.Label()
        Me.lblBody = New System.Windows.Forms.Label()
        Me.txtTo = New System.Windows.Forms.TextBox()
        Me.txtSubject = New System.Windows.Forms.TextBox()
        Me.txtBody = New System.Windows.Forms.TextBox()
        Me.txtCC = New System.Windows.Forms.TextBox()
        Me.lblBCC = New System.Windows.Forms.Label()
        Me.lblCC = New System.Windows.Forms.Label()
        Me.erpEmailAddresses = New System.Windows.Forms.ErrorProvider()
        Me.txtBCC = New System.Windows.Forms.TextBox()
        Me.cboPriority = New System.Windows.Forms.ComboBox()
        Me.btnBrowse = New System.Windows.Forms.Button()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.lstAttachments = New System.Windows.Forms.ListBox()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.odlgAttachment = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'mnuMain
        '
        Me.mnuMain.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuFile, Me.mnuHelp})
        Me.mnuMain.RightToLeft = CType(resources.GetObject("mnuMain.RightToLeft"), System.Windows.Forms.RightToLeft)
        '
        'mnuFile
        '
        Me.mnuFile.Enabled = CType(resources.GetObject("mnuFile.Enabled"), Boolean)
        Me.mnuFile.Index = 0
        Me.mnuFile.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuExit})
        Me.mnuFile.Shortcut = CType(resources.GetObject("mnuFile.Shortcut"), System.Windows.Forms.Shortcut)
        Me.mnuFile.ShowShortcut = CType(resources.GetObject("mnuFile.ShowShortcut"), Boolean)
        Me.mnuFile.Text = resources.GetString("mnuFile.Text")
        Me.mnuFile.Visible = CType(resources.GetObject("mnuFile.Visible"), Boolean)
        '
        'mnuExit
        '
        Me.mnuExit.Enabled = CType(resources.GetObject("mnuExit.Enabled"), Boolean)
        Me.mnuExit.Index = 0
        Me.mnuExit.Shortcut = CType(resources.GetObject("mnuExit.Shortcut"), System.Windows.Forms.Shortcut)
        Me.mnuExit.ShowShortcut = CType(resources.GetObject("mnuExit.ShowShortcut"), Boolean)
        Me.mnuExit.Text = resources.GetString("mnuExit.Text")
        Me.mnuExit.Visible = CType(resources.GetObject("mnuExit.Visible"), Boolean)
        '
        'mnuHelp
        '
        Me.mnuHelp.Enabled = CType(resources.GetObject("mnuHelp.Enabled"), Boolean)
        Me.mnuHelp.Index = 1
        Me.mnuHelp.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuAbout})
        Me.mnuHelp.Shortcut = CType(resources.GetObject("mnuHelp.Shortcut"), System.Windows.Forms.Shortcut)
        Me.mnuHelp.ShowShortcut = CType(resources.GetObject("mnuHelp.ShowShortcut"), Boolean)
        Me.mnuHelp.Text = resources.GetString("mnuHelp.Text")
        Me.mnuHelp.Visible = CType(resources.GetObject("mnuHelp.Visible"), Boolean)
        '
        'mnuAbout
        '
        Me.mnuAbout.Enabled = CType(resources.GetObject("mnuAbout.Enabled"), Boolean)
        Me.mnuAbout.Index = 0
        Me.mnuAbout.Shortcut = CType(resources.GetObject("mnuAbout.Shortcut"), System.Windows.Forms.Shortcut)
        Me.mnuAbout.ShowShortcut = CType(resources.GetObject("mnuAbout.ShowShortcut"), Boolean)
        Me.mnuAbout.Text = resources.GetString("mnuAbout.Text")
        Me.mnuAbout.Visible = CType(resources.GetObject("mnuAbout.Visible"), Boolean)
        '
        'btnSend
        '
        Me.btnSend.AccessibleDescription = CType(resources.GetObject("btnSend.AccessibleDescription"), String)
        Me.btnSend.AccessibleName = CType(resources.GetObject("btnSend.AccessibleName"), String)
        Me.btnSend.Anchor = CType(resources.GetObject("btnSend.Anchor"), System.Windows.Forms.AnchorStyles)
        Me.btnSend.BackColor = System.Drawing.SystemColors.Control
        Me.btnSend.BackgroundImage = CType(resources.GetObject("btnSend.BackgroundImage"), System.Drawing.Image)
        Me.btnSend.Dock = CType(resources.GetObject("btnSend.Dock"), System.Windows.Forms.DockStyle)
        Me.btnSend.Enabled = CType(resources.GetObject("btnSend.Enabled"), Boolean)
        Me.erpEmailAddresses.SetError(Me.btnSend, resources.GetString("btnSend.Error"))
        Me.btnSend.FlatStyle = CType(resources.GetObject("btnSend.FlatStyle"), System.Windows.Forms.FlatStyle)
        Me.btnSend.Font = CType(resources.GetObject("btnSend.Font"), System.Drawing.Font)
        Me.btnSend.ForeColor = System.Drawing.SystemColors.ControlText
        Me.erpEmailAddresses.SetIconAlignment(Me.btnSend, CType(resources.GetObject("btnSend.IconAlignment"), System.Windows.Forms.ErrorIconAlignment))
        Me.erpEmailAddresses.SetIconPadding(Me.btnSend, CType(resources.GetObject("btnSend.IconPadding"), Integer))
        Me.btnSend.Image = CType(resources.GetObject("btnSend.Image"), System.Drawing.Bitmap)
        Me.btnSend.ImageAlign = CType(resources.GetObject("btnSend.ImageAlign"), System.Drawing.ContentAlignment)
        Me.btnSend.ImageIndex = CType(resources.GetObject("btnSend.ImageIndex"), Integer)
        Me.btnSend.ImeMode = CType(resources.GetObject("btnSend.ImeMode"), System.Windows.Forms.ImeMode)
        Me.btnSend.Location = CType(resources.GetObject("btnSend.Location"), System.Drawing.Point)
        Me.btnSend.Name = "btnSend"
        Me.btnSend.RightToLeft = CType(resources.GetObject("btnSend.RightToLeft"), System.Windows.Forms.RightToLeft)
        Me.btnSend.Size = CType(resources.GetObject("btnSend.Size"), System.Drawing.Size)
        Me.btnSend.TabIndex = CType(resources.GetObject("btnSend.TabIndex"), Integer)
        Me.btnSend.Text = resources.GetString("btnSend.Text")
        Me.btnSend.TextAlign = CType(resources.GetObject("btnSend.TextAlign"), System.Drawing.ContentAlignment)
        Me.btnSend.Visible = CType(resources.GetObject("btnSend.Visible"), Boolean)
        '
        'txtFrom
        '
        Me.txtFrom.AccessibleDescription = CType(resources.GetObject("txtFrom.AccessibleDescription"), String)
        Me.txtFrom.AccessibleName = CType(resources.GetObject("txtFrom.AccessibleName"), String)
        Me.txtFrom.Anchor = CType(resources.GetObject("txtFrom.Anchor"), System.Windows.Forms.AnchorStyles)
        Me.txtFrom.AutoSize = CType(resources.GetObject("txtFrom.AutoSize"), Boolean)
        Me.txtFrom.BackColor = System.Drawing.SystemColors.Window

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -