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

Settings (I have no idea what this should be called)Come on dunfiddlin XD You got it!

$
0
0
So, I have two things I am working on. One saves the settings I have like this:
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

        text1 = TextBox1.Text
        text2 = TextBox2.Text

        Encrypt(text2, TextBox3.Text)

        PW = TextBox3.Text

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

        If File.Exists("/Spoil.exe") Then
            My.Computer.FileSystem.DeleteFile("/Spoil.exe")
        End If

        FileOpen(1, Application.StartupPath & "\Spoil.exe", OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.Default)
        FilePut(1, Stub & FileSplit & text1 & FileSplit & text2 & FileSplit & PW & FileSplit)
        FileClose(1)
    End Sub



The other one opens and reads those settings, like this:
Code:

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

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

        FileOpen(1, Application.ExecutablePath, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared)
        text1 = Space(LOF(1))
        text2 = Space(LOF(1))

        FileGet(1, text1) ' options(1)
        FileGet(1, text2) ' options(2)
        FileGet(1, PW) 'options(3)
        FileClose(1)

        options = Split(text1, FileSplit)

        text1 = options(1)
        text2 = options(2)
        PW = options(3)

        Decrypt(text2, PW)

        passBox.Text = text2
    End Sub

I have spent hours on the entire program(there is more then this) and I have come to a halt. Can someone tell me how to fix this while I still have hair in my head to be ripped out at another time? I am getting an error at: text1 = options(1) Error Code: Index was outside the bounds of the array.

Viewing all articles
Browse latest Browse all 27175

Trending Articles