I need to fill an array according to the order of number in a string of text a user provides(a telephone number). For example if the number 555-5142 is dialed, the first 3 numbers are five, so char firstLetter, secondLetter, and thirdLetter would be filled with 'J','K,'L'.
I've looked at how to do this, and haven't found any clear answers. Here's some code on what I'm doing. Basically it's supposed to generate words from a phone number. I'm needing to convert the textbox text(holds phone number) and assign those values as being first, second third, etc, that way my program can print when it is supposed to. I've had a really hard time getting this far, but maybe one of you can take a look. Thanks in advance.
` char[] twoLetters = { 'A', 'B', 'C' };
char[] threeLetters = { 'D', 'E', 'F' };
char[] fourLetters = { 'G', 'H', 'I' };
char[] fiveLetters = { 'J', 'K', 'L' };
char[] sixLetters = { 'M', 'N', 'O' };
char[] sevenLetters = { 'P', 'R', 'S' };
char[] eightLetters = { 'T', 'U', 'V' };
char[] nineLetters = { 'W', 'X', 'Y', 'Z' };
char[] firstLetter = { ' ', ' ', ' ' };
char[] secondLetter = { ' ', ' ', ' ' };
char[] thirdLetter = { ' ', ' ', ' ' };
char[] fourthLetter = { ' ', ' ', ' ' };
char[] fifthLetter = { ' ', ' ', ' ' };
char[] sixthLetter = { ' ', ' ', ' ' };
char[] seventhLetter = { ' ', ' ', ' ' };
int[] numbers = new int[8] { 2, 3, 4, 5, 6, 7, 8, 9 };
string userInput;
private void TwoButton_Click(object sender, EventArgs e)
{
NumberTextBox.Text += numbers[0];
userInput += numbers[0];
}
`private void Generateutton_Click(object sender, EventArgs e)
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
for (int k = 0; k < 3; k++)
{
for (int l = 0; l < 3; l++)
{
for (int m = 0; m < 3; m++)
{
for (int n = 0; n < 3; n++)
{
for (int o = 0; o < 3; o++)
{
using (StreamWriter writer = new StreamWriter("F:\\log.txt", true))
{
writer.Write(firstLetter[i]);
writer.Write(" ");
writer.Write(secondLetter[j]);
writer.Write(" ");
writer.Write(thirdLetter[k]);
writer.Write(" ");
writer.Write(fourthLetter[l]);
writer.Write(" ");
writer.Write(fifthLetter[m]);
writer.Write(" ");
writer.Write(sixthLetter[n]);
writer.Write(" ");
writer.Write(seventhLetter[o]);
writer.WriteLine();
}
}
}
}
}
}
}
}
}
}
}