[Visual Basic.net] Simple File Pumper

A Place For Programmers Of All Levels To Discuss Programming & Web Building.

Moderator: Community Moderator

Post Reply
User avatar
djfshady
Corporal
Corporal
Posts: 25
Joined: 26 Nov 2010, 20:12
Location: United Kingdom
Been thanked: 5 times
Contact:

[Visual Basic.net] Simple File Pumper

Post by djfshady »

what you need:
2 buttons
2 labels
2 textbox's
1 opendialog

button 1 name: ...
button 2 name: Add
label 1 name: File
label 2 name: bytes to add (in mb)

textbox1 next to button1
textbox2 next to button2
label1 above textbox1
label2 above textbox2
[size=large]Don't Compress it (Using Winrar , 7zip) Or any compressing program , cause it back's to original size[/size]

Code: Select all

Imports System.IO

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        OpenFileDialog1.DefaultExt = "exe"
        OpenFileDialog1.Filter = "exe files (*.exe)|*.exe"
        OpenFileDialog1.FilterIndex = 1
        If OpenFileDialog1.ShowDialog(Me) = DialogResult.OK Then
            TextBox1.Text = String.Empty
            TextBox1.Text = OpenFileDialog1.FileName
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If TextBox1.Text = "" Then
            MsgBox("Enter bytes to add")
        Else
            Dim file1 = File.OpenWrite(TextBox1.Text)
            Dim siza = file1.Seek(0, SeekOrigin.[End])
            Dim size = Convert.ToInt32(TextBox2.Text)
            Dim bite As Decimal = size * 1048576
            While siza < bite
                siza += 1
                file1.WriteByte(0)
            End While
            file1.Close()
            MessageBox.Show("Done !")
        End If
    End Sub
End Class
Image
Post Reply

Return to “Programming/Web Building Chat & Support”