Tri Cutherell

Tri Cutherell

  • NA
  • 3
  • 1.1k

I like to ask for help with a piece of code.

Mar 7 2014 6:11 PM
Hello Everyone,
 
I am a new user to learning C# therefore I haven't adapt myself to the language terminology.
 
I like to know if I can get help with thispiece of code.
 
----------------------------------------------------------------------------
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;

namespace ChatterBox

   {

      public partial class Form1 : Form

      {

         public Form1()

            {

               InitializeComponent();

            }

      private void Form1_Load(object sender, EventArgs e)

      {

         string[] strLabel = {

                              "Hi",

                              "Chao",

                              "Hello"

                              };

         Random hello = new Random();

         int iSelect = hello.Next(0, 2);

         textBox1.Text = strLabel[iSelect];

      }

      private void button1_Click(object sender, EventArgs e)

      {

         {

            textBox1.Clear();

            textBox2.Clear();

         }

      }

 

   }

}
----------------------------------------------------------
So what this code does so far is when it runs a random text appears from textBox1 then after I enter something textBox1 and textBox2 clear when I click on 'Enter' button. I'm not sure where to go from here. I like textBox1 to accept a random word, from 3 words, and have the cursor in textBox2 waiting for my input.
 
This is all I can try and do for now. Any help is greatly appreciated.
 
Thank you.


Answers (3)