Hello everyone. I'm trying to write a phone number word generator. I have the basic form setup and a dialing pad. The dialing pad dials just like a phone, except it only has keys 2-9. I'm trying to print out all the possibilities a phone number could produce using streamwriter. I can write to a file, but not correctly. This is why I'm here. I'm needing help. I think I need to create an array from the textbox displaying my whole number and use that to write to the file, instead of when a button is clicked it shoots it's values(a,b,c) to the file. Here's my code, any thoughts on this would be greatly appreciated.
`using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace TelephoneNumberWordGenerator
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
char[] arrayTwo = { 'a', 'b', 'c' };
char[] arrayThree = { 'd', 'e', 'f' };
char[] arrayFour = { 'g', 'h', 'i' };
char[] arrayFive = { 'j', 'k', 'l' };
char[] arraySix = { 'm', 'n', 'o' };
char[] arraySeven = { 'p', 'r', 's' };
char[] arrayEight = { 't', 'u', 'v' };
char[] arrayNine = { 'w', 'x', 'y', 'z' };
int[] userInput = new int[8];
int[] numberInput =new int[8]{2,3,4,5,6,7,8,9};
int maxLength = 7;
private void GenerateButton_Click(object sender, EventArgs e)
{
// nothing here yet, because i'm currently just using the numbers dialed to generate //automatically as each number is dialed(thinking this is wrong to do)
}
private void TwoButton_Click(object sender, EventArgs e)
{
if (EnteredNumberTextBox.TextLength < maxLength)
{
EnteredNumberTextBox.Text += Convert.ToString(numberInput[0]);
}
try
{
using (StreamWriter writer = new StreamWriter("F:\\GeneratedWords.txt", true))
{
for (int counter = 0; counter < maxLength; counter++)
{
writer.WriteLine("A");
}
for (int counter = 0; counter < maxLength; counter++)
{
writer.WriteLine("B");
}
for (int counter = 0; counter < maxLength; counter++)
{
writer.Write("C");
}
}
}
catch (UnauthorizedAccessException uAEX)
{
MessageBox.Show("You don't have access to the system.");
}
}`
// assume all other buttons are set up the same as above...except with their corresponding //letters(3-DEF, 4-GHI, etc)