Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27348

File IO help!

$
0
0
So I am using this to put information into a file:

Code:

    Dim Stub, text1, text2, PW As String
    Const FileSplit = "@#$%SWAGDAYZ%$#@"
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim Input As String = Nothing
        Dim q As String = FileSplit

        text1 = TextBox1.Text

        text2 = Encrypt(TextBox2.Text, TextBox3.Text)

        TextBox3.Text = text2

        PW = TextBox3.Text

        Input = Stub & q & text1 & q & text2 & q & PW

        FileOpen(1, Application.StartupPath & "\Stub.exe", OpenMode.Binary, OpenAccess.Read, OpenShare.Default)
        Stub = Space(LOF(1))
        FileGet(1, Stub)
        FileClose(1)

        If File.Exists(Application.StartupPath + "\Server.exe") Then
            My.Computer.FileSystem.DeleteFile(Application.StartupPath + "\Server.exe")
        End If

        FileOpen(1, Application.StartupPath & "\Stub.exe", OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.Default)
        FilePut(1, Input)
        FileClose(1)
        MsgBox("Server made successfully", MsgBoxStyle.OkOnly, "Success")
    End Sub


And this to pull it from that file and use the information:
Code:

    Dim stub, text1, text2, PW As String
    Dim user, pass As String
    Const FileSplit = "@#$%SWAGDAYZ%$#@"
    Dim options() As String

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.ShowInTaskbar = False

        FileOpen(1, Application.ExecutablePath, OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.Default)
        text1 = Space(LOF(1))
        text2 = Space(LOF(1))
        PW = Space(LOF(1))
        FileGet(1, text1) ' options(1)
        FileGet(1, text2) ' options(2)
        FileGet(1, PW) 'options(3)
        FileClose(1)

        options = Split(text1, FileSplit)

        passBox.Text = text1

        'options = text1.Split(FileSplit)

        'text2 = Decrypt(text2, PW)

        'passBox.Text = text2

        'Check1()

    End Sub

I am getting so much fail it hurts. Can you guys look over it and tell me how to fix it?

Viewing all articles
Browse latest Browse all 27348

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>