I'm currently trying to make an application (just for learning purposes to try to get used to C# because I'm kinda new) and I've wanted to create a sort of to say Terminal within the Form. I've decided to try to use a text-box with multiple lines and tried using if and else statements but when I go into the text box and start typing it immediately goes to the error message that I set up for 'else' after every keystroke. I don't know what it is but I feel like I'm missing something. Any suggestions? Also, would it be possible to create my own "commands" for that application alone in itself? I'm talking about like when you type in lets say "program_speech" it will come up with a dialog asking for user input and it will basically convert text to speech with the built in Speech Synthesizer for Windows. Thanks! All help is appreciated!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Terminator //Lol Terminator Reference
{
public partial class Form1 : Form
{
private string answer;
public Form1()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (answer == "help")
{
MessageBox.Show("There is only 2 commands as of now and that is 'help' and 'program_speech' ");
}
else if (answer == "program_speech")
{
MessageBox.Show("Still currently under creation");
}
else
{
MessageBox.Show("Invalid Command. Please try again or type help for current available commands");
}
}
}
}