Showing posts with label Visual Studio Trick & Tipps. Show all posts

how to Make Cleint / App / EXE/ Visual Basic Auto Update With Script

Introduction:
This tutorial is on how to create an auto update function for a program in Visual Basic.

Notes:
- You will need a website for the latest version to be hosted for download and checking. Or, for testing you can use localhost like I am (I'm using XAMPP).
- If you're using a localhost, only people on your network can use this auto update function.

Steps of Creation:
Before we start we want to create a new form with one button for the update process to begin. we also want to import:

  1. Imports System.IO
  2. Imports System.Net
Step 1:
First we want to get the latest version of the program available which is hosted in a version.txt file on our website/localhost. Let's get the source of that file and compare it to our programs current version...

  1. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  2. Dim src As String = getSrc("http://127.0.0.1/autoUpdater/version.txt")
  3. If (src.Contains(My.Settings.version)) Then
  4. MsgBox("Up to date!")
  5. End If
  6. End Sub
  7. Private Function getSrc(ByVal url As String)
  8. Dim r As httpwebrequest = httpwebrequest.create(url)
  9. Dim re As httpwebresponse = r.getresponse()
  10. Dim src As String = New streamreader(re.getresponsestream()).readtoend()
  11. Return src
  12. End Function
Step 3:
Now that we have the latest version available and have output "Up to date!" if the current programs version is up to date we can make it download the latest file if it is not up to date...

  1. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  2. Dim src As String = getSrc("http://127.0.0.1/autoUpdater/version.txt")
  3. If (src.Contains(My.Settings.version)) Then
  4. MsgBox("Up to date!")
  5. Else
  6. MsgBox("Outdated, Downloading new exe...")
  7. Try
  8. My.Computer.Network.DownloadFile("http://127.0.0.1/autoUpdater/" & src.Replace(" ", "") & "/download.exe", CurDir() & "/updates/" & src & ".exe")
  9. MsgBox("Downloaded, Running...")
  10. Diagnostics.Process.Start(CurDir() & "/updates/" & src & ".exe")
  11. MsgBox("Finished!")
  12. Me.Close()
  13. Catch ex As Exception
  14. MsgBox("Updated file not found...")
  15. End Try
  16. End If
  17. End Sub
We surround the process in a try and catch statement just in case anything fails such as if the program isn't available to download.
Once we have downloaded the file and saved it we run it and close our current program. The final thing to do is to set the version of our program(s)...
Step 4:
To set a version setting for our program you want to go to:
Project > Project Properties > Settings, and create a new String named version and set the value to the current version of the program.

Project Complete!
That's it! Below is the source code to all the files, the directory formats and download to the program...

Auto Update Visual Basic Program:
  1. Imports System.IO
  2. Imports System.Net
  3. Public Class Form1
  4. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  5. Dim src As String = getSrc("http://127.0.0.1/autoUpdater/version.txt")
  6. If (src.Contains(My.Settings.version)) Then
  7. MsgBox("Up to date!")
  8. Else
  9. MsgBox("Outdated, Downloading new exe...")
  10. Try
  11. My.Computer.Network.DownloadFile("http://127.0.0.1/autoUpdater/" & src.Replace(" ", "") & "/download.exe", CurDir() & "/updates/" & src & ".exe")
  12. MsgBox("Downloaded, Running...")
  13. Diagnostics.Process.Start(CurDir() & "/updates/" & src & ".exe")
  14. MsgBox("Finished!")
  15. Me.Close()
  16. Catch ex As Exception
  17. MsgBox("Updated file not found...")
  18. End Try
  19. End If
  20. End Sub
  21. Private Function getSrc(ByVal url As String)
  22. Dim r As httpwebrequest = httpwebrequest.create(url)
  23. Dim re As httpwebresponse = r.getresponse()
  24. Dim src As String = New streamreader(re.getresponsestream()).readtoend()
  25. Return src
  26. End Function
  27. End Class
Version.txt:
  1. 0.2
Website Directory Format:
Root/version.txt in the root of the site which holds the latest version of the program available for download.
Root/0.2/download.exe Contains the downloadable.exe for the version 0.2 of my program ready for download.

If you have a version 2.0 just create the folder appropriately, like so:
Root/2.0/download.exe

How to make an advanced chat spammer in VB,NET

Hey guys its Meher c: and imma show you how to make an advanced chat spammer <3

This is what you will need on your form...

2 Buttons
1 Timer (Enabled = False)(Interval = 100)
2 Labels
2 textboxes
(Should look like this)



Once you got all that on your form now we can input the codes c:

Double Click Button1 and input this code (Text = Start)
Timer1.start


Basically this is telling the timer1 to start to send the text in textbox1.text.

Double Click button2 and input this code (Text = Stop)
Timer1.stop
Label1.text = "0"


Basically this is telling the timer1 to stop sending the text in textbox1.text and clearing out label 1 of the total amount sent.

Double click Timer1 and input this code
Sendkeys.send(textbox1.text)
Sendkeys.send("{ENTER}")
label1.text = Label1.text + 1
Textbox2.text = timer1.interval * 50


This is telling to send the text on textbox1.text to where you are spamming, The second code is telling to send the key Enter to be automatically clicked, The third code is telling label1.text to add 1 number more every time it sends the text, The fourth code is basically timer1.interval = textbox2.text * 50 so that'll be the speed of how fast you send it.

When you're done all that rename the text on all you buttons and labels c: (Should look like this)


Hope this helps some people C: Please leave your feedback <3 

[How-To] Use DevExpress Skins

This tutorial is simple to show you how to get started using DevExpress Windows Forms Skins. This is user and noob friendly, so use as pleased.

You will need:
Visual Studio OR Visual C# OR Visual Basic (I'm using C#, however, it's not much different, so just use a online conversion tool, or ask)
DevExpress - Get a trial here or get the cracked copy if you have premium here
Common Sense

1. Download and install DevExpress. This should be very simple to do, if you're new and downloading the trial from their page, get the one stating "Visual Studio Controls".

2. Create a new Windows Form Project:
[​IMG]

3. In the solution explorer, right click on "References" and choose "Add Reference":
[​IMG]

4. Navigate to the .NET tab and sort by name. Then you will want to choose the following DLLs (control click to select multiple at a time):
DevExpress.BonusSkins
DevExpress.Data
DevExpress.OfficeSkins
DevExpress.Utils
DevExpress.XtraEditors (not shown in image)
[​IMG]

5. On the form, hit F7 to load the code behind onto your screen
[​IMG]

6. Now in this step, you will be inheriting the DevExpress form, enabling skins, and registering them for use. You will change the following:
A. Where it says Form1 after the colon, change it to the following:
Code (Text):
DevExpress.XtraEditors.XtraForm
B. In the constructor (public Form1), enable the skin by adding the following:
Code (Text):
DevExpress.Skins.SkinManager.EnableFormSkins();
C. Also in the constructor, register the bonus skins and office skins (or one of them that you wish to only use):
Code (Text):
DevExpress.UserSkins.BonusSkins.Register();
DevExpress.UserSkins.OfficeSkins.Register();
[​IMG]

7. Navigate back to the design tab.

8. View the Form1's properties by:
Right clicking the form > Properties
or
Clicking the form and selecting the Properties tab

9. Find the option "LookAndFeel" and expand it.

10. Set the option "UseDefaultLookAndFeel" to False, then set the SkinName to whatever you would like. I used Darkroom just for an example.

Please note that all skins do not change on the fly or fully change in visual studio, however, they do once the program is ran or debugged.
[​IMG]

11. Final Output:
[​IMG]

You're finished! Comment and/or ask questions as needed.

If you would like to know how to use the well known DotNetBar, please check out the following two tutorials:

Visual Basic Tutorial #1 | Calculator

How to make your own calculator​



What you are making:​
[​IMG]​

Difficulty: Very easy
Time: 5-10 minutes​

Step 1:
Create a New Project -> Windows Forms Application

Step 2:
Create:

4 Buttons
2 Labels
2 Text Box

Step 3:
Rename the buttons to +, -, x, /
[​IMG]

Move the two text box's to the top
[​IMG]

Click the labels and remove the text saying Label.
You should have something looking like this.
[​IMG]
Do that to both, put one in-between the two Text box's and the other where you would like the answer to show.

Should look something like this.

[​IMG]

Step 4: Coding:
Double click the + button 
It should open up this.
[​IMG]

Add this code:

Code (Text):
 Label2.Text = "+"
Label1.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
Codes for other buttons

Step 5:
Check the error list:
[​IMG]

If there are 0 then you can go ahead and test it out.

Click the debug button. [​IMG]

Now try it out and you may need to move the labels so it looks good.

Then you are done!

[​IMG]