Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.92 KB | None | 0 0
  1. Imports System.IO
  2.  
  3. Public Class Form1
  4.  
  5.  
  6. dim working as boolean=false
  7. dim workthread as Thread
  8.  
  9.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  10.  
  11. if working=true
  12. MsgBox("Already Busy Working")
  13. exit sub
  14. end if    
  15.  
  16. workthread = New Thread(AddressOf WorkSub)
  17. workthread.start()
  18.  
  19.     End Sub
  20.  
  21.  
  22. Sub WorkSub()
  23. working=true
  24.    Dim LineOfText As String = "test.txt"
  25.         Dim i As Integer
  26.         Dim aryTextFile() As String
  27.         Dim TextLine As String
  28.  
  29.         If System.IO.File.Exists(LineOfText) = True Then
  30.  
  31.  
  32.  
  33.             Dim objReader As New System.IO.StreamReader(LineOfText)
  34.  
  35.             Do While objReader.Peek() <> -1
  36.                 TextLine = objReader.ReadLine()
  37.  
  38.                 aryTextFile = TextLine.Split(":")
  39.                 For i = 0 To UBound(aryTextFile)
  40.  
  41.  
  42.  
  43.                 Next i
  44.  
  45.  
  46.                 '  The mailman object is used for receiving (POP3)
  47.                 '  and sending (SMTP) email.
  48.                 Dim mailman As New Chilkat.MailMan()
  49.  
  50.                 '  Any string argument automatically begins the 30-day trial.
  51.                 Dim success As Boolean
  52.                 success = mailman.UnlockComponent("30-day trial")
  53.                 If (success <> True) Then
  54.                     MsgBox("Component unlock failed")
  55.                     Exit Sub
  56.                 Else
  57.  
  58.                 End If
  59.  
  60.  
  61.  
  62.  
  63.                 '  Set the POP3 server's hostname
  64.                 mailman.MailHost = "pop.aol.com"
  65.  
  66.                 '  Set the POP3 login/password.
  67.                 mailman.PopUsername = aryTextFile(0)
  68.                 mailman.PopPassword = aryTextFile(1)
  69.  
  70.                 '  You may explicitly begin and end POP3 sessions by calling
  71.                 '  Pop3BeginSession and Pop3EndSession.  However,
  72.                 '  if a method is called that requires a connection to the POP3
  73.                 '  server, the connection and session will become established
  74.                 '  automatically.  Therefore, it is not required to explicitly call
  75.                 '  Pop3BeginSession and Pop3EndSession.
  76.  
  77.                 success = mailman.Pop3BeginSession()
  78.                 If (success <> True) Then
  79.  
  80.  
  81.  
  82.                     LineOfText = String.Join(":", aryTextFile)
  83.                     MsgBox(LineOfText)
  84.  
  85.                     MsgBox("Not Success")
  86.                     Dim swriter As StreamWriter
  87.                     swriter = File.AppendText("bad.txt")
  88.                     swriter.WriteLine(LineOfText)
  89.                     swriter.Close()
  90.                    
  91.  
  92.                 Else
  93.  
  94.                     MsgBox("success")
  95.                     Dim swriter As StreamWriter
  96.                     swriter = File.AppendText("good.txt")
  97.                     swriter.WriteLine(LineOfText)
  98.                     swriter.Close()
  99.                 End If
  100.             Loop
  101.  
  102.  
  103.         End If
  104.  
  105. working=false
  106.  
  107. End Sub
  108.  
  109.  
  110. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement