(05-20-2011, 01:54 AM)besimbicer Wrote: [ -> ]its and love you
edit : opps its only apps :S need source file ;)
And you are in doubt of it, since it deals with accounts. hahaha
Here it is:
Full Form Codes:
Code:
Imports System.IO
Public Class Form1
Private Sub Button1_Click(sender As System.Object, _
e As System.EventArgs) Handles Button1.Click
bgw2.RunWorkerAsync()
End Sub
Private Sub Button2_Click(sender As System.Object, _
e As System.EventArgs) _
Handles Button2.Click
Using ofd As New OpenFileDialog() With {.Multiselect = True, _
.Filter = "Txt files |*.txt"}
Dim dialog As OpenFileDialog = ofd
If (dialog.ShowDialog = DialogResult.OK) Then
Dim fileName As String = dialog.FileName
Me.TextBox3.Text = fileName
displayallaccounts(fileName)
End If
End Using
End Sub
Private Sub Button3_Click(sender As System.Object, _
e As System.EventArgs) _
Handles Button3.Click
If checkemail(TextBox4.Text) = True Then
bgw1.RunWorkerAsync()
Else
MsgBox("Destination email is invalid.", _
MsgBoxStyle.Information, "Error")
End If
End Sub
Private Sub Button4_Click(sender As System.Object, _
e As System.EventArgs) Handles Button4.Click
bgw1.CancelAsync()
End Sub
Private Sub Form1_Load(sender As System.Object, _
e As System.EventArgs) Handles MyBase.Load
System.Windows.Forms.Form.CheckForIllegalCrossThreadCalls = False
End Sub
Private Sub displayallaccounts(ByVal File As String)
Try
Dim sr As StreamReader
Dim fs As FileStream
fs = New FileStream((File), FileMode.OpenOrCreate)
sr = New StreamReader(fs)
Dim line As String
line = sr.ReadLine
While Not line = Nothing
Dim split As String() = line.Split(New [Char]() {":"})
Dim email As String = split(0)
Dim pass As String = split(1)
If checkemail(email) = True Then
If isgmail(email) = True Then
ListView1.Items.Add(email)
ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(pass)
Else
'If not Gmail
End If
Else
'If not valid email
End If
line = sr.ReadLine
End While
sr.Close()
fs.Close()
Catch ex As System.Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error")
End Try
End Sub
Private Sub bgw1_DoWork(sender As System.Object, _
e As System.ComponentModel.DoWorkEventArgs) _
Handles bgw1.DoWork
EmailValid.Text = 0
Dim lvi As ListViewItem
For Each lvi In ListView1.Items
If bgw1.CancellationPending Then
e.Cancel = True
Else
Dim email As String = lvi.Text
Dim pass As String = lvi.SubItems(1).Text()
Dim destination As String = TextBox4.Text
Status.Text = "Checking: "
EmailCheck.Text = email
If testgmail(email, pass, destination) = True Then
ListView2.Items.Add(email)
ListView2.Items(ListView2.Items.Count - 1).SubItems.Add(pass)
EmailValid.Text += 1
End If
End If
Next
Status.Text = "Status: "
EmailCheck.Text = "Ready"
MsgBox("Email checker completed." & vbNewLine & _
"Found valid emails: " & EmailValid.Text, _
MsgBoxStyle.Information, "Completed")
End Sub
Private Sub bgw2_DoWork(sender As System.Object, _
e As System.ComponentModel.DoWorkEventArgs) _
Handles bgw2.DoWork
Try
EmailValid.Text = 0
Status.Text = "Checking: "
EmailCheck.Text = TextBox1.Text
If checkemail(TextBox4.Text) = True Then
If testgmail(TextBox1.Text, TextBox2.Text, TextBox4.Text) = True Then
Status.Text = "Status: "
EmailCheck.Text = "Ready"
EmailValid.Text += 1
MsgBox(TextBox1.Text & " is valid.", _
MsgBoxStyle.Information, "Success")
Else
MsgBox(TextBox1.Text & " is invalid", _
MsgBoxStyle.Information, "Error")
End If
Else
'Invalid email
MsgBox("Destination email is invalid.", _
MsgBoxStyle.Information, "Error")
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, "Error")
End Try
End Sub
End Class
Module Codes:
Code:
Imports System.IO
Public Class Form1
Private Sub Button1_Click(sender As System.Object, _
e As System.EventArgs) Handles Button1.Click
bgw2.RunWorkerAsync()
End Sub
Private Sub Button2_Click(sender As System.Object, _
e As System.EventArgs) _
Handles Button2.Click
Using ofd As New OpenFileDialog() With {.Multiselect = True, _
.Filter = "Txt files |*.txt"}
Dim dialog As OpenFileDialog = ofd
If (dialog.ShowDialog = DialogResult.OK) Then
Dim fileName As String = dialog.FileName
Me.TextBox3.Text = fileName
displayallaccounts(fileName)
End If
End Using
End Sub
Private Sub Button3_Click(sender As System.Object, _
e As System.EventArgs) _
Handles Button3.Click
If checkemail(TextBox4.Text) = True Then
bgw1.RunWorkerAsync()
Else
MsgBox("Destination email is invalid.", _
MsgBoxStyle.Information, "Error")
End If
End Sub
Private Sub Button4_Click(sender As System.Object, _
e As System.EventArgs) Handles Button4.Click
bgw1.CancelAsync()
End Sub
Private Sub Form1_Load(sender As System.Object, _
e As System.EventArgs) Handles MyBase.Load
System.Windows.Forms.Form.CheckForIllegalCrossThreadCalls = False
End Sub
Private Sub displayallaccounts(ByVal File As String)
Try
Dim sr As StreamReader
Dim fs As FileStream
fs = New FileStream((File), FileMode.OpenOrCreate)
sr = New StreamReader(fs)
Dim line As String
line = sr.ReadLine
While Not line = Nothing
Dim split As String() = line.Split(New [Char]() {":"})
Dim email As String = split(0)
Dim pass As String = split(1)
If checkemail(email) = True Then
If isgmail(email) = True Then
ListView1.Items.Add(email)
ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(pass)
Else
'If not Gmail
End If
Else
'If not valid email
End If
line = sr.ReadLine
End While
sr.Close()
fs.Close()
Catch ex As System.Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error")
End Try
End Sub
Private Sub bgw1_DoWork(sender As System.Object, _
e As System.ComponentModel.DoWorkEventArgs) _
Handles bgw1.DoWork
EmailValid.Text = 0
Dim lvi As ListViewItem
For Each lvi In ListView1.Items
If bgw1.CancellationPending Then
e.Cancel = True
Else
Dim email As String = lvi.Text
Dim pass As String = lvi.SubItems(1).Text()
Dim destination As String = TextBox4.Text
Status.Text = "Checking: "
EmailCheck.Text = email
If testgmail(email, pass, destination) = True Then
ListView2.Items.Add(email)
ListView2.Items(ListView2.Items.Count - 1).SubItems.Add(pass)
EmailValid.Text += 1
End If
End If
Next
Status.Text = "Status: "
EmailCheck.Text = "Ready"
MsgBox("Email checker completed." & vbNewLine & _
"Found valid emails: " & EmailValid.Text, _
MsgBoxStyle.Information, "Completed")
End Sub
Private Sub bgw2_DoWork(sender As System.Object, _
e As System.ComponentModel.DoWorkEventArgs) _
Handles bgw2.DoWork
Try
EmailValid.Text = 0
Status.Text = "Checking: "
EmailCheck.Text = TextBox1.Text
If checkemail(TextBox4.Text) = True Then
If testgmail(TextBox1.Text, TextBox2.Text, TextBox4.Text) = True Then
Status.Text = "Status: "
EmailCheck.Text = "Ready"
EmailValid.Text += 1
MsgBox(TextBox1.Text & " is valid.", _
MsgBoxStyle.Information, "Success")
Else
MsgBox(TextBox1.Text & " is invalid", _
MsgBoxStyle.Information, "Error")
End If
Else
'Invalid email
MsgBox("Destination email is invalid.", _
MsgBoxStyle.Information, "Error")
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, "Error")
End Try
End Sub
End Class
It's up to you how you will judge it, hehehe. As what I said, it is for checking only.
I am working for a nice UI for this app.