nik_language

GUARDAR DE TEXTBOX Y COMBOBOX A TXT [2]

Jul 19th, 2017
533
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. Imports System.IO
  2. Imports System.Net.Mail
  3. Public Class Form1
  4. Private Sub email1()
  5. Dim comida = ComboBox1.SelectedItem
  6. Dim bebida = ComboBox2.SelectedItem
  7. Dim nombre = TextBox1.Text
  8. Dim apellido = TextBox2.Text
  9. Try
  10. Dim Smtp_Server As New SmtpClient
  11. Dim e_mail As New MailMessage()
  12. Smtp_Server.UseDefaultCredentials = False
  13. Smtp_Server.Credentials = New Net.NetworkCredential("juan-breydy@hotmail.com", "tingomaria2015")
  14. Smtp_Server.Port = 587
  15. Smtp_Server.EnableSsl = True
  16. Smtp_Server.Host = "smtp.office365.com"
  17.  
  18. e_mail = New MailMessage()
  19. e_mail.From = New MailAddress("juan-breydy@hotmail.com")
  20. e_mail.To.Add("juan-breydy@hotmail.com")
  21. e_mail.Subject = ("Encuesta:" + nombre + apellido)
  22. e_mail.IsBodyHtml = False
  23. e_mail.Body = ("TIQUETE" + vbNewLine + "Comida: " + comida + vbNewLine + "Bebida: " + bebida + vbNewLine + "Usuario: " + nombre + apellido)
  24. Smtp_Server.Send(e_mail)
  25.  
  26.  
  27. Catch error_t As Exception
  28. MsgBox("ha ocurrido un error")
  29. Exit Sub
  30. End Try
  31. End Sub
  32. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  33. Dim comida = ComboBox1.SelectedItem
  34. Dim bebida = ComboBox2.SelectedItem
  35. Dim nombre = TextBox1.Text
  36. Dim apellido = TextBox2.Text
  37.  
  38. email1()
  39.  
  40. End Sub
  41.  
  42. Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click
  43.  
  44. End Sub
  45. End Class
Add Comment
Please, Sign In to add comment