TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
jay john
NA
1
2k
Guess the Word GUI help
Apr 5 2013 7:57 PM
Hey I'm having trouble completing this program. I need to check the users letter guess when they hit the guess button.
Here's what I have so far:
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 GuessAWord
{
public partial class Form1 : Form
{
int randomNumber;
Random ranNumberGenerator;
string ranWord;
string[] words;
const int MAXWORDS = 10;
public Form1()
{
words = new string[MAXWORDS];
ranNumberGenerator = new Random();
words[0] = "dog";
words[1] = "cat";
words[2] = "fish";
words[3] = "bird";
words[4] = "elephant";
words[5] = "tiger";
words[6] = "lion";
words[7] = "snake";
words[8] = "walrus";
words[9] = "owl";
InitializeComponent();
}
private void startButton_Click(object sender, EventArgs e)
{
randomNumber = ranNumberGenerator.Next(0, 10);
ranWord = words[randomNumber];
mysteryLabel.Text = "";
for (int i = 0; i < ranWord.Length; i++)
{
mysteryLabel.Text += "*";
}
feedbackLabel.Text = "";
guessButton.Enabled = true;
userTextbox.Select();
}
private void guessButton_Click(object sender, EventArgs e)
{
}
}
}
Reply
Answers (
0
)
Windows Form Event to Upload Files
Defining function to return a string value