Hiya,
A short while ago, I posted the following code snippet in reply to someone who was looking to make a simple encoded password... See here for a full explanation of how this works -->http://www.daniweb.com/forums/post1470261.html#post1470261.
While this method is a little cumbersome, it does work and can be encoded and decoded the same on any PC so long as the program version is the same.
Well, that's all fine, but what if you wanted to grease the cogs a bit and stop it from churning through hundreds of textboxes everytime it has to go converting a letter to something else.
What if instead of having two groups of textboxes, I simply declare the whole lot to memory instead. So I will have FixTex1 through to FixTex36 for my fixed alphabet and MixTex1 through to MixTex36 for my mixed/scrambled alphabet.
How then do I modify the code below to say 'For Each FixTex in memory' or 'For Each FixTex in DimGroupFixed', blah, blah, blah?
And a s sub-question to all of this, declaring it into memory: Will it really grease the cogs to make it run faster or will I just sap even more system resource to hold the data in place?
Many thanks in advance,
Rob.
1: For Each FixedTBox In Me.grpFixedAlpha.Controls
If TypeOf FixedTBox Is TextBox Then
Dim EncodeLetter As String
EncodeLetter = Mid(txtInput.Text, txtSelectChar.Text, 1)
If EncodeLetter = "" Then
MsgBox("Your message has been Encoded.")
Exit Sub
Else
If Mid(FixedTBox.text, 3, 1) = EncodeLetter Then
Dim TBoxRef
TBoxRef = Mid(FixedTBox.Text, 1, 2)
For Each DynamicTBox In Me.grpDynamicAlpha.Controls
If TypeOf DynamicTBox Is TextBox Then
If TBoxRef = Mid(DynamicTBox.Text, 1, 2) Then
Dim Output As String
Output = txtOutput.Text
txtOutput.Text = Output & Mid(DynamicTBox.text, 3, 1)
txtSelectChar.Text = txtSelectChar.Text + 1
End If
End If
Next DynamicTBox
End If
End If
End If
Next FixedTBox
GoTo 1