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

📄 frmmain.vb

📁 VB.NET - NET Framework - How-To Send Mai VB.NET 发送邮件的示例代码
💻 VB
📖 第 1 页 / 共 5 页
字号:
        Me.btnBrowse.CausesValidation = False
        Me.btnBrowse.Dock = CType(resources.GetObject("btnBrowse.Dock"), System.Windows.Forms.DockStyle)
        Me.btnBrowse.Enabled = CType(resources.GetObject("btnBrowse.Enabled"), Boolean)
        Me.erpEmailAddresses.SetError(Me.btnBrowse, resources.GetString("btnBrowse.Error"))
        Me.btnBrowse.FlatStyle = CType(resources.GetObject("btnBrowse.FlatStyle"), System.Windows.Forms.FlatStyle)
        Me.btnBrowse.Font = CType(resources.GetObject("btnBrowse.Font"), System.Drawing.Font)
        Me.btnBrowse.ForeColor = System.Drawing.SystemColors.ControlText
        Me.erpEmailAddresses.SetIconAlignment(Me.btnBrowse, CType(resources.GetObject("btnBrowse.IconAlignment"), System.Windows.Forms.ErrorIconAlignment))
        Me.erpEmailAddresses.SetIconPadding(Me.btnBrowse, CType(resources.GetObject("btnBrowse.IconPadding"), Integer))
        Me.btnBrowse.Image = CType(resources.GetObject("btnBrowse.Image"), System.Drawing.Bitmap)
        Me.btnBrowse.ImageAlign = CType(resources.GetObject("btnBrowse.ImageAlign"), System.Drawing.ContentAlignment)
        Me.btnBrowse.ImageIndex = CType(resources.GetObject("btnBrowse.ImageIndex"), Integer)
        Me.btnBrowse.ImeMode = CType(resources.GetObject("btnBrowse.ImeMode"), System.Windows.Forms.ImeMode)
        Me.btnBrowse.Location = CType(resources.GetObject("btnBrowse.Location"), System.Drawing.Point)
        Me.btnBrowse.Name = "btnBrowse"
        Me.btnBrowse.RightToLeft = CType(resources.GetObject("btnBrowse.RightToLeft"), System.Windows.Forms.RightToLeft)
        Me.btnBrowse.Size = CType(resources.GetObject("btnBrowse.Size"), System.Drawing.Size)
        Me.btnBrowse.TabIndex = CType(resources.GetObject("btnBrowse.TabIndex"), Integer)
        Me.btnBrowse.Text = resources.GetString("btnBrowse.Text")
        Me.btnBrowse.TextAlign = CType(resources.GetObject("btnBrowse.TextAlign"), System.Drawing.ContentAlignment)
        Me.btnBrowse.Visible = CType(resources.GetObject("btnBrowse.Visible"), Boolean)
        '
        'Label1
        '
        Me.Label1.AccessibleDescription = CType(resources.GetObject("Label1.AccessibleDescription"), String)
        Me.Label1.AccessibleName = CType(resources.GetObject("Label1.AccessibleName"), String)
        Me.Label1.Anchor = CType(resources.GetObject("Label1.Anchor"), System.Windows.Forms.AnchorStyles)
        Me.Label1.AutoSize = CType(resources.GetObject("Label1.AutoSize"), Boolean)
        Me.Label1.Dock = CType(resources.GetObject("Label1.Dock"), System.Windows.Forms.DockStyle)
        Me.Label1.Enabled = CType(resources.GetObject("Label1.Enabled"), Boolean)
        Me.erpEmailAddresses.SetError(Me.Label1, resources.GetString("Label1.Error"))
        Me.Label1.Font = CType(resources.GetObject("Label1.Font"), System.Drawing.Font)
        Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.erpEmailAddresses.SetIconAlignment(Me.Label1, CType(resources.GetObject("Label1.IconAlignment"), System.Windows.Forms.ErrorIconAlignment))
        Me.erpEmailAddresses.SetIconPadding(Me.Label1, CType(resources.GetObject("Label1.IconPadding"), Integer))
        Me.Label1.Image = CType(resources.GetObject("Label1.Image"), System.Drawing.Image)
        Me.Label1.ImageAlign = CType(resources.GetObject("Label1.ImageAlign"), System.Drawing.ContentAlignment)
        Me.Label1.ImageIndex = CType(resources.GetObject("Label1.ImageIndex"), Integer)
        Me.Label1.ImeMode = CType(resources.GetObject("Label1.ImeMode"), System.Windows.Forms.ImeMode)
        Me.Label1.Location = CType(resources.GetObject("Label1.Location"), System.Drawing.Point)
        Me.Label1.Name = "Label1"
        Me.Label1.RightToLeft = CType(resources.GetObject("Label1.RightToLeft"), System.Windows.Forms.RightToLeft)
        Me.Label1.Size = CType(resources.GetObject("Label1.Size"), System.Drawing.Size)
        Me.Label1.TabIndex = CType(resources.GetObject("Label1.TabIndex"), Integer)
        Me.Label1.Text = resources.GetString("Label1.Text")
        Me.Label1.TextAlign = CType(resources.GetObject("Label1.TextAlign"), System.Drawing.ContentAlignment)
        Me.Label1.Visible = CType(resources.GetObject("Label1.Visible"), Boolean)
        '
        'lstAttachments
        '
        Me.lstAttachments.AccessibleDescription = CType(resources.GetObject("lstAttachments.AccessibleDescription"), String)
        Me.lstAttachments.AccessibleName = CType(resources.GetObject("lstAttachments.AccessibleName"), String)
        Me.lstAttachments.Anchor = CType(resources.GetObject("lstAttachments.Anchor"), System.Windows.Forms.AnchorStyles)
        Me.lstAttachments.BackgroundImage = CType(resources.GetObject("lstAttachments.BackgroundImage"), System.Drawing.Image)
        Me.lstAttachments.CausesValidation = False
        Me.lstAttachments.ColumnWidth = CType(resources.GetObject("lstAttachments.ColumnWidth"), Integer)
        Me.lstAttachments.Dock = CType(resources.GetObject("lstAttachments.Dock"), System.Windows.Forms.DockStyle)
        Me.lstAttachments.Enabled = CType(resources.GetObject("lstAttachments.Enabled"), Boolean)
        Me.erpEmailAddresses.SetError(Me.lstAttachments, resources.GetString("lstAttachments.Error"))
        Me.lstAttachments.Font = CType(resources.GetObject("lstAttachments.Font"), System.Drawing.Font)
        Me.lstAttachments.HorizontalExtent = CType(resources.GetObject("lstAttachments.HorizontalExtent"), Integer)
        Me.lstAttachments.HorizontalScrollbar = CType(resources.GetObject("lstAttachments.HorizontalScrollbar"), Boolean)
        Me.erpEmailAddresses.SetIconAlignment(Me.lstAttachments, CType(resources.GetObject("lstAttachments.IconAlignment"), System.Windows.Forms.ErrorIconAlignment))
        Me.erpEmailAddresses.SetIconPadding(Me.lstAttachments, CType(resources.GetObject("lstAttachments.IconPadding"), Integer))
        Me.lstAttachments.ImeMode = CType(resources.GetObject("lstAttachments.ImeMode"), System.Windows.Forms.ImeMode)
        Me.lstAttachments.IntegralHeight = CType(resources.GetObject("lstAttachments.IntegralHeight"), Boolean)
        Me.lstAttachments.ItemHeight = CType(resources.GetObject("lstAttachments.ItemHeight"), Integer)
        Me.lstAttachments.Items.AddRange(New Object() {resources.GetString("lstAttachments.Items.Items")})
        Me.lstAttachments.Location = CType(resources.GetObject("lstAttachments.Location"), System.Drawing.Point)
        Me.lstAttachments.Name = "lstAttachments"
        Me.lstAttachments.RightToLeft = CType(resources.GetObject("lstAttachments.RightToLeft"), System.Windows.Forms.RightToLeft)
        Me.lstAttachments.ScrollAlwaysVisible = CType(resources.GetObject("lstAttachments.ScrollAlwaysVisible"), Boolean)
        Me.lstAttachments.Size = CType(resources.GetObject("lstAttachments.Size"), System.Drawing.Size)
        Me.lstAttachments.TabIndex = CType(resources.GetObject("lstAttachments.TabIndex"), Integer)
        Me.lstAttachments.Visible = CType(resources.GetObject("lstAttachments.Visible"), Boolean)
        '
        'Label2
        '
        Me.Label2.AccessibleDescription = CType(resources.GetObject("Label2.AccessibleDescription"), String)
        Me.Label2.AccessibleName = CType(resources.GetObject("Label2.AccessibleName"), String)
        Me.Label2.Anchor = CType(resources.GetObject("Label2.Anchor"), System.Windows.Forms.AnchorStyles)
        Me.Label2.AutoSize = CType(resources.GetObject("Label2.AutoSize"), Boolean)
        Me.Label2.Dock = CType(resources.GetObject("Label2.Dock"), System.Windows.Forms.DockStyle)
        Me.Label2.Enabled = CType(resources.GetObject("Label2.Enabled"), Boolean)
        Me.erpEmailAddresses.SetError(Me.Label2, resources.GetString("Label2.Error"))
        Me.Label2.Font = CType(resources.GetObject("Label2.Font"), System.Drawing.Font)
        Me.erpEmailAddresses.SetIconAlignment(Me.Label2, CType(resources.GetObject("Label2.IconAlignment"), System.Windows.Forms.ErrorIconAlignment))
        Me.erpEmailAddresses.SetIconPadding(Me.Label2, CType(resources.GetObject("Label2.IconPadding"), Integer))
        Me.Label2.Image = CType(resources.GetObject("Label2.Image"), System.Drawing.Bitmap)
        Me.Label2.ImageAlign = CType(resources.GetObject("Label2.ImageAlign"), System.Drawing.ContentAlignment)
        Me.Label2.ImageIndex = CType(resources.GetObject("Label2.ImageIndex"), Integer)
        Me.Label2.ImeMode = CType(resources.GetObject("Label2.ImeMode"), System.Windows.Forms.ImeMode)
        Me.Label2.Location = CType(resources.GetObject("Label2.Location"), System.Drawing.Point)
        Me.Label2.Name = "Label2"
        Me.Label2.RightToLeft = CType(resources.GetObject("Label2.RightToLeft"), System.Windows.Forms.RightToLeft)
        Me.Label2.Size = CType(resources.GetObject("Label2.Size"), System.Drawing.Size)
        Me.Label2.TabIndex = CType(resources.GetObject("Label2.TabIndex"), Integer)
        Me.Label2.Text = resources.GetString("Label2.Text")
        Me.Label2.TextAlign = CType(resources.GetObject("Label2.TextAlign"), System.Drawing.ContentAlignment)
        Me.Label2.Visible = CType(resources.GetObject("Label2.Visible"), Boolean)
        '
        'odlgAttachment
        '
        Me.odlgAttachment.Filter = resources.GetString("odlgAttachment.Filter")
        Me.odlgAttachment.Title = resources.GetString("odlgAttachment.Title")
        '
        'frmMain
        '
        Me.AccessibleDescription = CType(resources.GetObject("$this.AccessibleDescription"), String)
        Me.AccessibleName = CType(resources.GetObject("$this.AccessibleName"), String)
        Me.Anchor = CType(resources.GetObject("$this.Anchor"), System.Windows.Forms.AnchorStyles)
        Me.AutoScaleBaseSize = CType(resources.GetObject("$this.AutoScaleBaseSize"), System.Drawing.Size)
        Me.AutoScroll = CType(resources.GetObject("$this.AutoScroll"), Boolean)
        Me.AutoScrollMargin = CType(resources.GetObject("$this.AutoScrollMargin"), System.Drawing.Size)
        Me.AutoScrollMinSize = CType(resources.GetObject("$this.AutoScrollMinSize"), System.Drawing.Size)
        Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
        Me.CausesValidation = False
        Me.ClientSize = CType(resources.GetObject("$this.ClientSize"), System.Drawing.Size)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label2, Me.lstAttachments, Me.btnBrowse, Me.cboPriority, Me.txtBCC, Me.txtCC, Me.lblBCC, Me.lblCC, Me.txtBody, Me.txtSubject, Me.txtTo, Me.txtFrom, Me.btnSend, Me.lblBody, Me.lblSubject, Me.lblTo, Me.lblFrom, Me.Label1})
        Me.Dock = CType(resources.GetObject("$this.Dock"), System.Windows.Forms.DockStyle)
        Me.Enabled = CType(resources.GetObject("$this.Enabled"), Boolean)
        Me.Font = CType(resources.GetObject("$this.Font"), System.Drawing.Font)
        Me.ForeColor = System.Drawing.Color.Blue
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.ImeMode = CType(resources.GetObject("$this.ImeMode"), System.Windows.Forms.ImeMode)
        Me.Location = CType(resources.GetObject("$this.Location"), System.Drawing.Point)
        Me.MaximizeBox = False
        Me.MaximumSize = CType(resources.GetObject("$this.MaximumSize"), System.Drawing.Size)
        Me.Menu = Me.mnuMain
        Me.MinimumSize = CType(resources.GetObject("$this.MinimumSize"), System.Drawing.Size)
        Me.Name = "frmMain"
        Me.RightToLeft = CType(resources.GetObject("$this.RightToLeft"), System.Windows.Forms.RightToLeft)
        Me.StartPosition = CType(resources.GetObject("$this.StartPosition"), System.Windows.Forms.FormStartPosition)
        Me.Text = resources.GetString("$this.Text")
        Me.Visible = CType(resources.GetObject("$this.Visible"), Boolean)
        Me.ResumeLayout(False)

    End Sub

#End Region

#Region " Standard Menu Code "
    ' <System.Diagnostics.DebuggerStepThrough()> has been added to some procedures since they are
    ' not the focus of the demo. Remove them if you wish to debug the procedures.
    ' This code simply shows the About form.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub mnuAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAbout.Click
        ' Open the About form in Dialog Mode
        Dim frm As New frmAbout()
        frm.ShowDialog(Me)
        frm.Dispose()
    End Sub

    ' This code will close the form.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub mnuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExit.Click
        ' Turn of validation for all controls with CausesValidation = True or else
        ' you will not be able to close the Form until valid data is entered.
        txtTo.CausesValidation = False
        txtFrom.CausesValidation = False

        ' Close the current form
        Me.Close()
    End Sub
#End Region

    Dim arlAttachments As ArrayList

    ' Checks for empty strings and does basic check for valid email
    ' address.
    Private Sub ValidateEmailAddress(ByVal txt As TextBox)
        ' Confirm there is text in the control.
        If txt.TextLength = 0 Then
            Throw New Exception("Email address is a required field")
        Else
            ' Confirm that there is a "." and an "@" in the e-mail address.
            If txt.Text.IndexOf(".") = -1 Or txt.Text.IndexOf("@") = -1 Then
                Throw New Exception("E-mail address must be valid e-mail " & _
                    "address format." & ControlChars.Cr & "For example " & _
                    "'someone@microsoft.com'")
            End If
        End If
    End Sub

    ' This method overrides the WndProc of the Form and catches the Close message
    ' passed when the user attempts to exit the Form. Without this there is no way
    ' to prevent the ErrorProvider control from attempting to validate the "To" and 
    ' "From" TextBox controls (the only controls with CausesValidation = True). If
    ' invalid or no data is entered when the user attempts to close the Form, the

⌨️ 快捷键说明

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