![]() |
Assigning first character of variable into an array
What I am trying to do is a very simple encrypt/decrypt program. I must point out now that I am very new at this and this is my first working program.
I load a file into a text box and have the content of the textbox in a variable. I need to then assign the first 20 characters into an array, change the characters, then read the array backwards. This is what I came up with: :
FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input)Any suggestions? What am I doing wrong? |
Well your code looks like it (could) work, could you post the exact error message (I expect its an array bounds error). However, this is a distinctly VB6-ish approach: remember strings are arrays of characters, your function creates, marshals, and destroys loads of unecessary objects. Put Option Explicit and Strict on for starters to see where, and leave them on. The .NET way of doing this would be creating a stream processor, and using a stack for the reversal. However if this is your first program, I'd suggest mastering something like ROT13 first.
|
| All times are GMT -5. The time now is 4:27 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC