Visual Basic File Pumper

Discussion in 'Programming' started by x:Biohazard:x, Jan 3, 2010.

  1. #1
    [align=center][size=medium]Visual Basic File Pumper[/size][/align]

    Components Needed
    • 2 Buttons
    • 2 Radio Buttons
    • 1 Text Box
    • 1 Numeric UpDown

    Change the text of the buttons "File" and "Pump"
    And The Radio Buttons To
    Radio button2="Megabyte"
    Radio button1="Kilobyte"
    With the numeric updown there will be no text in it. That will be where you select big you want the file to become (file size)

    I set mine up to look like this...(pic in spoiler)
    [​IMG]

    Double click button with the text "File" and add...
           
    Dim ofd As New OpenFileDialog
    ofd.Filter = "Exe Files|*.exe"
    ofd.ShowDialog()
    TextBox1.Text = ofd.FileName
    Code (markup):
    Next double click the button with the text "Pump" and add..
    
            Dim sfd As New SaveFileDialog
            sfd.Filter = "Exe Files|*.exe"
            sfd.ShowDialog()
            Dim filesize As Double = Val(NumericUpDown1.Value)
            IO.File.Copy(TextBox1.Text, sfd.FileName)
            If RadioButton1.Checked Then
                filesize = filesize * 1024
            End If
            If RadioButton2.Checked Then
                filesize = filesize * 1048576
            End If
            Dim filetopump = IO.File.OpenWrite(sfd.FileName)
            Dim size = filetopump.Seek(0, IO.SeekOrigin.[End])
            While size < filesize
                filetopump.WriteByte(0)
                size += 1
            End While
            filetopump.Close()
            MsgBox("Successfully Pumped!")
    
    Code (markup):
    and thats pretty much it, ya real easy if you have any questions just post or pm
     
    x:Biohazard:x, Jan 3, 2010 IP
  2. WaQas

    WaQas Well-Known Member

    Messages:
    170
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    113
    #2
    its really easy to learn .. gud.. keep it up..
     
    WaQas, Jan 20, 2010 IP