Xolara's Tutorials - xolara - 10-01-2010
Hey
i will try and post some tutorials here Text based but with final project to download
Re: Xolara's Tutorials - xolara - 10-01-2010
A1 Downloader
Hey
First of all ill list what you will need for this tutorial
3 Textboxes
4 Labels
1 button
1 Progressbar
1 FolderBrowserDialog
there wont be much explanation just the full code i putted in <!-- s --><img src="{SMILIES_PATH}/icon_razz.gif" alt="" title="Razz" /><!-- s -->
Code: Imports System.Net
Public Class Form1
Public WithEvents download As New WebClient
Private Sub TextBox2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.Click
FolderBrowserDialog1.ShowDialog()
TextBox2.Text = FolderBrowserDialog1.SelectedPath
End Sub
Private Sub download_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles download.DownloadProgressChanged
ProgressBar1.Value = e.ProgressPercentage
lblprogress.Text = ProgressBar1.Value
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox2.Text = FolderBrowserDialog1.SelectedPath
download.DownloadFileAsync(New Uri(TextBox1.Text), TextBox2.Text + "\" + TextBox3.Text)
End Sub
End Class
my textboxes is like this
Textbox1 = Link
Textbox2 = Location
Textbox3 = Name
Code: download.DownloadFileAsync(New Uri(the link here), Location here + "\" + Name of it like wow.exe etc)
Simple code play with it a little <!-- s --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt="" title="Smile" /><!-- s -->
Link for youtube video : http://www.youtube.com/watch?v=IB6dNvWxoKU
Movie duration is :2:41
Re: Xolara's Tutorials - brandonio21 - 10-02-2010
Great tutorial, Im going to have to use some of these methods in TwitControl for downloading updates!
Re: Xolara's Tutorials - xolara - 10-04-2010
Removed
Re: Xolara's Tutorials - xolara - 10-04-2010
A3 - Encrypter
1 Form
2 Textboxes 1 of them is multilined and the other is for password
2 buttons Encrypt and Decrypt
Code: Public Class Form1
Dim DES As New System.Security.Cryptography.TripleDESCryptoServiceProvider
Dim Hash As New System.Security.Cryptography.MD5CryptoServiceProvider
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
DES.Key = Hash.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox1.Text))
DES.Mode = Security.Cryptography.CipherMode.ECB
Dim DESEncrypter As System.Security.Cryptography.ICryptoTransform = DES.CreateEncryptor
Dim Buffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox2.Text)
TextBox2.Text = Convert.ToBase64String(DESEncrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
Catch ex As Exception
MessageBox.Show("The following error(s) have occurred: " & ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
DES.Key = Hash.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox1.Text))
DES.Mode = Security.Cryptography.CipherMode.ECB
Dim DESDecrypter As System.Security.Cryptography.ICryptoTransform = DES.CreateDecryptor
Dim Buffer As Byte() = Convert.FromBase64String(TextBox2.Text)
TextBox2.Text = System.Text.ASCIIEncoding.ASCII.GetString(DESDecrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
Catch ex As Exception
MessageBox.Show("The following error(s) have occurred: " & ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
End Class
Re: Xolara's Tutorials - xolara - 10-04-2010
A4 - Emailer
(Note: The attachment to the this tutorial i have added some more stuff than there is in this tut But nothing special <!-- s --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt="" title="Smile" /><!-- s --> )
1 Loginform (Can be found if u Create a new form and look for LoginForm)
1 Form
LoginForm list
Well mostly leave it as it is but add
1 Checkbox
What u need on Form1
2 textboxes
1 richtextbox
3 Buttons
1 OpenFileDialog
4 Labels
First of all go to your Projects Properties and go to the Settings Tab
add
Username | String | User
Password | String | User
Well here is the code for LoginForm
Code: Public Class LoginForm1
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
Dim dir As New IO.DirectoryInfo("C:\Xolara's E-Mailer")
If dir.Exists Then
Else
System.IO.Directory.CreateDirectory("C:\Xolara's E-Mailer")
If PasswordTextBox.Text = "" Then
MsgBox("Please enter a valid password", MsgBoxStyle.Exclamation, "Error!")
End If
End If
If UsernameTextBox.Text.Contains("@hotmail.com") = False Then
MsgBox("Please enter a valid hotmail adress", MsgBoxStyle.Exclamation, "Error!")
Else
If CheckBox1.Checked = True Then
My.Computer.FileSystem.WriteAllText("C:\Xolara's E-Mailer\Username.txt", UsernameTextBox.Text, False)
My.Computer.FileSystem.WriteAllText("C:\Xolara's E-Mailer\Password.txt", PasswordTextBox.Text, False)
Else
' ' if the checkbox have been checked before and you remove it it will remove the username and password from the textfiles
My.Computer.FileSystem.WriteAllText("C:\Xolara's E-Mailer\Username.txt", "", False)
My.Computer.FileSystem.WriteAllText("C:\Xolara's E-Mailer\Password.txt", "", False)
End If
My.Settings.Username = UsernameTextBox.Text
My.Settings.Password = PasswordTextBox.Text
MsgBox("You have succesfully logged in", MsgBoxStyle.Information, "Succes!")
Form1.Show()
Me.Close()
End If
End Sub
Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
Me.Close()
End Sub
Private Sub LoginForm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dir As New IO.DirectoryInfo("C:\Xolara's E-Mailer")
If dir.Exists Then
UsernameTextBox.Text = My.Computer.FileSystem.ReadAllText("C:\Xolara's E-Mailer\Username.txt")
PasswordTextBox.Text = My.Computer.FileSystem.ReadAllText("C:\Xolara's E-Mailer\Password.txt")
Else
System.IO.Directory.CreateDirectory("C:\Xolara's E-Mailer")
End If
End Sub
End Class
Form1 Code
Code: Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label4.Text = ""
OpenFileDialog1.FileName = ""
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim message As New Net.Mail.MailMessage(My.Settings.Username, TextBox1.Text, TextBox2.Text, RichTextBox1.Text)
Dim smtp As New Net.Mail.SmtpClient("smtp.live.com", 587)
Dim user As New Net.NetworkCredential(My.Settings.Username, My.Settings.Password)
smtp.enableSsl = True
smtp.Credentials = user
smtp.port = 587
smtp.host = "smtp.live.com"
smtp.send(message)
MsgBox("Your message was Succesfully sent!", MsgBoxStyle.Information, "Succes!")
Catch ex As Exception
MsgBox("Error - " + ex.Message, MsgBoxStyle.Exclamation, "Error")
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If OpenFileDialog1.ShowDialog = System.Windows.Forms.DialogResult.Cancel Then
Else
Label4.Text = OpenFileDialog1.SafeFileName
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If OpenFileDialog1.FileName = "" Then
MsgBox("Please select an attachment", MsgBoxStyle.Exclamation, "Error")
Else
Try
Dim message As New Net.Mail.MailMessage(My.Settings.Username, TextBox1.Text, TextBox2.Text, RichTextBox1.Text)
Dim smtp As New Net.Mail.SmtpClient("smtp.live.com", 587)
Dim user As New Net.NetworkCredential(My.Settings.Username, My.Settings.Password)
Dim attach As New Net.Mail.Attachment(OpenFileDialog1.FileName)
message.Attachments.Add(attach)
smtp.EnableSsl = True
smtp.Credentials = user
smtp.Port = 587
smtp.Host = "smtp.live.com"
smtp.Send(message)
MsgBox("Your message was Succesfully sent!", MsgBoxStyle.Information, "Succes!")
Catch ex As Exception
MsgBox("Error - " + ex.Message, MsgBoxStyle.Exclamation, "Error")
End Try
End If
End Sub
Re: Xolara's Tutorials - xolara - 10-07-2010
A5 - Chat spammer
(Note: Decided to make a movie out of this since its a small code)
1 textbox
1 trackbar
1 timer
2 buttons
2 labels
Code: Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Interval = TrackBar1.Value
Timer1.Enabled = True
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
End Sub
Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
Label2.Text = TrackBar1.Value & "/1000 ms"
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
SendKeys.Send(TextBox1.Text)
SendKeys.Send("{enter}")
End Sub
End Class
Youtube: http://www.youtube.com/watch?v=c9X9HmTND5E
Re: Xolara's Tutorials - xolara - 01-29-2011
A6 - Red Button Component
Class Library
Code: Public Class RedButtonComponent
Inherits windows.forms.button
Public Sub New()
Me.Size = New System.Drawing.Point(90, 25)
Me.FlatStyle = Windows.Forms.FlatStyle.Flat
Me.FlatAppearance.BorderSize = 0
Me.FlatAppearance.BorderColor = System.Drawing.Color.Gray
Me.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent
Me.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent
Me.BackColor = System.Drawing.Color.Transparent
Me.BackgroundImage = My.Resources.RedButtonNormal
Me.BackgroundImageLayout = Windows.Forms.ImageLayout.Stretch
Me.Font = New System.Drawing.Font("Tahoma", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
End Sub
Private Sub RedButtonComponent_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
Me.BackgroundImage = My.Resources.RedButtonClick
End Sub
Private Sub RedButtonComponent_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseEnter
Me.BackgroundImage = My.Resources.RedButtonOver
End Sub
Private Sub RedButtonComponent_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseLeave
Me.BackgroundImage = My.Resources.RedButtonNormal
End Sub
Private Sub RedButtonComponent_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
Me.BackgroundImage = My.Resources.RedButtonOver
End Sub
End Class
Button Images: <!-- m --><a class="postlink" href="http://dl.dropbox.com/u/12582973/red.zip">http://dl.dropbox.com/u/12582973/red.zip</a><!-- m -->
Youtube: <!-- m --><a class="postlink" href="http://www.youtube.com/watch?v=8ejPdkwWf-k">http://www.youtube.com/watch?v=8ejPdkwWf-k</a><!-- m -->
|