Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / April 2008

Tip: Looking for answers? Try searching our database.

Conversion from string to type double is not valid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ed Dror - 08 Apr 2008 18:07 GMT
Hi there,

I'm using asp.net 2.0 and I wrote

Public Function SendAlert() As Integer

       Try

           Dim nwln As String = System.Environment.NewLine
           Dim message As MailMessage = New MailMessage()

           message.From = New MailAddress("edd@andrewlauren.com")
           message.To.Add(New MailAddress("edd@andrewlauren.com"))

           message.Subject = "eCatalog Alert"
           message.Body = "On " + txtDate.Text + " " + txtCrtdUser.Text + "
added a new supplier in the Vendor name" + nwln + _
           "The following supplier was added " + nwln + _
           +nwln + _
           "Vendor_Name: " + txtVendorName.Text + nwln + _
           "Address1: " + txtAddress1.Text + nwln + _
           "Address2: " + txtAddress2.Text + nwln + _
           "City: " + txtCity.Text + nwln + _
           "State: " + txtState.Text + nwln + _
           "Zip: " + txtZip.Text + nwln + _
           "Phone: " + txtPhone.Text + nwln + _
           "Fax: " + txtFax.Text + nwln + _
           "Email: " + txtEmail.Text + nwln + _
           "URL: " + txtURL.Text + nwln

           Dim mailClient As New System.Net.Mail.SmtpClient()
           Dim basicAuthenticationInfo As New
System.Net.NetworkCredential("xxxxx", "xxxxx")

           mailClient.Host = "mail.xxxxx.com"
           mailClient.Port = "25"
           mailClient.UseDefaultCredentials = False
           mailClient.Credentials = basicAuthenticationInfo
           mailClient.Send(message)

       Catch ex As Exception
           ErrorMessage.Text = ex.Message.ToString
           Exit Try
       End Try
   End Function

   Protected Sub btnVendor_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnVendor.Click
       Try
           Call SendAlert()
       Catch ex As Exception
           ErrorMessage.Text = ex.Message.ToString
       End Try
   End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load

    txtCrtdUser.Text = User.Identity.Name
    Dim dtNow As DateTime = DateTime.Now
    txtDate.Text = dtNow.ToString

End Sub

Now when I'm click on Submit I'm getting error that says:

Conversion from string "On 4/8/2008 9:58:13 AM Ed Dror  " to type 'Double'
is not valid.

It looks like it reffer to the  txtCrtdUser.Text  and   txtDate.Text

How do I fix it ?

Thanks,
Ed Dror
joetcochran - 08 Apr 2008 18:59 GMT
Try using ampersand for the string concatenation, instead of plus.
Ed Dror - 08 Apr 2008 19:36 GMT
Joe,

You are abselutly currect.

Thanks,
Ed Dror

> Try using ampersand for the string concatenation, instead of plus.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.