Dynamic dimensioning (VB.net)

Sharky Forums


Results 1 to 3 of 3

Thread: Dynamic dimensioning (VB.net)

  1. #1
    Reef Shark Stasis's Avatar
    Join Date
    May 2001
    Location
    Wenatchee, WA, USA
    Posts
    373

    Dynamic dimensioning (VB.net)

    I need some help on an encryption program I am writing.
    I am just learning vb.net so bear with me...(i already know C++)
    I have an small encryption program im writing, you type your password in a feild, click 'encrypt' and it runs your password through a algorithm im writing. Heres my code to capture the password lenght, (and the password) and display them (to prove im doing it right). I declared password, and passlength before this(globally)

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    password = TextBox1.Text
    TextBox3.Text = password
    passlength = Len(password)
    TextBox4.Text = passlength

    End Sub


    I need to figure out how to dimension variables based on 'passlength'

    i dont know if you can do anything like this...but I was thinking a loop that would do something like this:

    dim looplength as integer
    looplength = 0
    do while looplength <= passlength
    dim var(looplength) as char
    looplength = looplength + 1
    loop


    and the line:
    dim var(looplength) as char
    dim's a char named var(and then this is whatever looplenght =) so that it would start with:
    var1 as char
    then when looplength = 2
    var2 as char
    then when looplenght = 3
    var3 as char

    do you understand what i mean? I need to figure out how to do this.

    -stasis

  2. #2
    Hammerhead Shark e_dawg's Avatar
    Join Date
    Jan 2001
    Location
    Earth, Western Hemisphere, North America, US, UT, SLC
    Posts
    2,628
    I think you are looking for an array.
    Last edited by e_dawg; 10-27-2002 at 08:00 PM.

  3. #3
    Reef Shark Stasis's Avatar
    Join Date
    May 2001
    Location
    Wenatchee, WA, USA
    Posts
    373
    yeah.....that didnt help at all.
    I was kinda looking for a code example.
    it doesnt even have to be all of it, just a little part of it...anything to get me somewhere.

    -stasis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •