ok, i needed a break from work. this is done in c#, but maybe you can follow the logic and re-write it.
this is just a windows application with 1 text box and 1 button.
keep in mind that arrays in c# are 0 based. if i remember correctly, VB arrays start on 1.
Code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Test
{
public class Form1 : System.Windows.Forms.Form
{
// declare your arraylist and current value here
private ArrayList x;
private int currentValue = 0;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
// setup your arraylist
x = new ArrayList();
x.Add("A");
x.Add("B");
x.Add("C");
x.Add("D");
x.Add("E");
x.Add("F");
x.Add("G");
x.Add("H");
x.Add("I");
x.Add("J");
x.Add("K");
x.Add("L");
x.Add("M");
x.Add("N");
x.Add("O");
x.Add("P");
x.Add("Q");
x.Add("R");
x.Add("S");
x.Add("T");
x.Add("U");
x.Add("V");
x.Add("W");
x.Add("X");
x.Add("Y");
x.Add("Z");
// print the current value to the text box
this.textBox1.Text = x[currentValue].ToString();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(32, 32);
this.button1.Name = "button1";
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(120, 32);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 1;
this.textBox1.Text = "";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
// increment the current value by 1
currentValue++;
// if the current value is higher than the amount of
// items in your array, set it to 0
if(currentValue >= x.Count)
{
currentValue = 0;
}
// print the current value to the text box
this.textBox1.Text = x[currentValue].ToString();
}
}
}
hope that helps.