Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. why this program run twice before terminate?

why this program run twice before terminate?

Scheduled Pinned Locked Moved Visual Basic
csharpdesignquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BabyOreo
    wrote on last edited by
    #1

    halo.. I want to send email to my account but this program run twice. So,after click on submit button, 2 same mails send to my account.How this could happen?:confused: Thanks. Imports System.Net.Mail Partial Class _Default Inherits System.Web.UI.Page Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click Try Dim message As New MailMessage(txtTo.Text, txtFrom.Text, txtSubject.Text, txtBody.Text) Dim emailClient As New SmtpClient(txtSMTPServer.Text) emailClient.Send(message) litStatus.Text = "Message Sent" Catch ex As Exception litStatus.Text = ex.ToString() End Try End Sub End Class

    D 1 Reply Last reply
    0
    • B BabyOreo

      halo.. I want to send email to my account but this program run twice. So,after click on submit button, 2 same mails send to my account.How this could happen?:confused: Thanks. Imports System.Net.Mail Partial Class _Default Inherits System.Web.UI.Page Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click Try Dim message As New MailMessage(txtTo.Text, txtFrom.Text, txtSubject.Text, txtBody.Text) Dim emailClient As New SmtpClient(txtSMTPServer.Text) emailClient.Send(message) litStatus.Text = "Message Sent" Catch ex As Exception litStatus.Text = ex.ToString() End Try End Sub End Class

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      You're looking for the ASP.NET Forum, not the VB.NET forum. You may want to post the code you have in the Load event handler there. It sounds like you're not handling Postback properly.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups