John Q

John Q

  • NA
  • 12
  • 44k

String array declare

Jan 17 2014 3:51 PM
I declared the following array variable as public and in my frmMain_Load it seemed to populate the array alright, but in my button1_Click, it said the arrayofDots[] is null.  Does anyone have any ideas?  Thanks in advance.

  public partial class frmMain : Form
  {
  public string[] arrayofDots;

-----
  private void frmMain_Load(object sender, EventArgs e)
  {
  string[] arrayofDots = new String[20];
 
  for (int cc = 0; cc <= 15; cc++) { arrayofDots[cc] = new string('.', 17 - cc); }
  }

-----

  private void button1_Click(object sender, EventArgs e)
  {
  for (int ii = 0; ii <= 15; ii++)
  {
  if (st.StartsWith(arrayofDots[ii].ToString()))





Answers (1)