So I've been working on my application and at the moment it changes letters in the textbox to numbers accordingly, using ascii (I then take 64 off the answer to bring it back down so A=1, B=2)
And then I use the split command to split the string into separate numbers.
For example, if you type in Dog, it outputs 041507.
So I need to split that into 04, 15 and 07.
I think my code does that, but I'm not sure, so I'd like it to write the separate numbers to different labels so that I can check if it's working. I also need to be able to access these separate numbers later on to add each to a matrix. So I'm wondering if I have to do an array, and how does that work when the user can type any word from dog, to a whole sentence like 'I need help with my program', how would you make an array that adds each number that has been split from the string, if my word/sentence can be any length?
So pretty much I am having trouble knowing:
1. If my program is actually splitting the values correctly.
2. How to make each of those later accessible to add each separately to matrices.
I hope I explained that well enough. It would be nice if you could explain it/tell me what I need to do/what would work best. I'm not asking for the code, just the process and I can guess and check/look up the actual code.
Thanks!
My Code
And then I use the split command to split the string into separate numbers.
For example, if you type in Dog, it outputs 041507.
So I need to split that into 04, 15 and 07.
I think my code does that, but I'm not sure, so I'd like it to write the separate numbers to different labels so that I can check if it's working. I also need to be able to access these separate numbers later on to add each to a matrix. So I'm wondering if I have to do an array, and how does that work when the user can type any word from dog, to a whole sentence like 'I need help with my program', how would you make an array that adds each number that has been split from the string, if my word/sentence can be any length?
So pretty much I am having trouble knowing:
1. If my program is actually splitting the values correctly.
2. How to make each of those later accessible to add each separately to matrices.
I hope I explained that well enough. It would be nice if you could explain it/tell me what I need to do/what would work best. I'm not asking for the code, just the process and I can guess and check/look up the actual code.
Thanks!
My Code
Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Make value include any text found in textbox1
Dim value As String = TextBox1.Text
'Make product equal to nothing at the start
Dim product As String = Nothing
'Change all letters to capital letters so that they work with Asc
For Each character In value.ToUpper()
'Convert letters to numbers using Asc, 64 must be taken from the answer so that the letters follow an A=1, B=2 pattern
product = ((Asc(character) - 64).ToString("00"))
Label1.Text = Label1.Text + product
'Returns an array containing "Look", "at", and "these!".
Dim Cool() As String = Split(value)
Next
End Sub
End Class