Click here to Skip to main content
15,888,106 members
Home / Discussions / C#
   

C#

 
GeneralRe: sound recorder Pin
Nadia Monalisa24-Sep-06 7:50
Nadia Monalisa24-Sep-06 7:50 
GeneralRe: sound recorder Pin
AB777124-Sep-06 20:20
AB777124-Sep-06 20:20 
GeneralRe: sound recorder Pin
Nadia Monalisa25-Sep-06 3:20
Nadia Monalisa25-Sep-06 3:20 
Questionicons needed Pin
sanah s22-Sep-06 19:45
sanah s22-Sep-06 19:45 
AnswerRe: icons needed Pin
seq-23-Sep-06 6:52
seq-23-Sep-06 6:52 
QuestionChat program with server behind a router Pin
Reve10122-Sep-06 15:07
Reve10122-Sep-06 15:07 
AnswerRe: Chat program with server behind a router Pin
seq-23-Sep-06 6:54
seq-23-Sep-06 6:54 
Questioncan someone help me??? simple shift algorithm Pin
roberto_santinni22-Sep-06 14:17
roberto_santinni22-Sep-06 14:17 
Hey guys,

Could you help me?? I'm trying to do a simple shift (caesar-like) algorithm. I can get it to shift but once I get to the end of the array, I can't figure out how to return to the first index and keep looking.
Example: plaintext -> abc
shift -> 3
ciphertext -> def

The problem comes when I try to shift one of the last characters in the array any number of positions forward. I get an IndexOutOfBoundsException and all I want to do is start over counting since the first index.
I hope I'm making myself clear.. anyway, here's the code.. thanks a lot!

private void shiftButton_Click(object sender, System.EventArgs e)
{
shiftLbl.Visible = false;
shiftNumber.Visible = false;
shiftButton.Visible = false;

string plainStr = plainTxt.Text;
String myAlphabet = new String(new char[72] {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8','9','\u0027','\u002E','\u002C','\u003A','\u003B','\u003F','\u0021','\u0023','\u0028','\u0029'});
int shiftNo = Convert.ToInt32(shiftNumber.Text);

for(int i=0;i<plainstr.length;i++)
{
="" for(int="" j="0;j<myAlphabet.Length;j++)
" if(plainstr[i]="=myAlphabet[j])
" ciphertxt.text="" +="myAlphabet[j+shiftNo];
" <b="">/*if(j+shiftNo>myAlphabet.Length)
{
j=-71;//trying to start over in the array
}*/ this commented code is what i'm trying to do
}

}

}

Santinni
AnswerRe: can someone help me??? simple shift algorithm Pin
Insincere Dave22-Sep-06 16:00
Insincere Dave22-Sep-06 16:00 
GeneralRe: can someone help me??? simple shift algorithm Pin
roberto_santinni22-Sep-06 18:55
roberto_santinni22-Sep-06 18:55 
GeneralRe: can someone help me??? simple shift algorithm Pin
roberto_santinni22-Sep-06 19:11
roberto_santinni22-Sep-06 19:11 
AnswerRe: can someone help me??? simple shift algorithm Pin
Guffa22-Sep-06 22:39
Guffa22-Sep-06 22:39 
QuestionPropertyGrid Help Pin
perlmunger22-Sep-06 13:35
perlmunger22-Sep-06 13:35 
AnswerRe: PropertyGrid Help Pin
e-laj22-Sep-06 14:19
e-laj22-Sep-06 14:19 
GeneralRe: PropertyGrid Help Pin
perlmunger22-Sep-06 16:54
perlmunger22-Sep-06 16:54 
GeneralRe: PropertyGrid Help Pin
e-laj22-Sep-06 18:59
e-laj22-Sep-06 18:59 
QuestionHelp with "posting" login info to a website.. Pin
SheriH22-Sep-06 12:45
SheriH22-Sep-06 12:45 
Questionincluding a help project in another project (same solution) Pin
gus_br22-Sep-06 10:48
gus_br22-Sep-06 10:48 
AnswerRe: including a help project in another project (same solution) Pin
Jim Conigliaro22-Sep-06 11:02
Jim Conigliaro22-Sep-06 11:02 
GeneralRe: including a help project in another project (same solution) Pin
gus_br22-Sep-06 11:22
gus_br22-Sep-06 11:22 
QuestionQuery File/Folder Security Pin
kickinmhl22-Sep-06 10:32
kickinmhl22-Sep-06 10:32 
AnswerRe: Query File/Folder Security Pin
Dave Kreskowiak22-Sep-06 13:20
mveDave Kreskowiak22-Sep-06 13:20 
QuestionReally transparent control: again! but serious. [modified] Pin
RomkaFromUa22-Sep-06 9:48
RomkaFromUa22-Sep-06 9:48 
AnswerRe: Really transparent control: again! but serious. Pin
gus_br22-Sep-06 10:51
gus_br22-Sep-06 10:51 
GeneralRe: Really transparent control: again! but serious. Pin
RomkaFromUa25-Sep-06 5:39
RomkaFromUa25-Sep-06 5:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.