0

I'm coding an application and I want to have a console embedded in the form. I am using a richtextbox currently but that is not nessecary. I want to disable everything in the richtextbox like: Selection, deleting with del key and backspace, show a _ after every word I type. And have commands that are recognised when typed in and entered. Thanks alot! ~Layne~

LarsTech
  • 80,625
  • 14
  • 153
  • 225
Layne3
  • 71
  • 1
  • 2
  • 7

2 Answers2

1

Answer. I created a listbox and a richtextbox. Textbox text (commands) get sent to the listbox. Here is the code I am using.

private void richTextBox2_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == Keys.Enter)
        {
            listBox2.Items.Add(richTextBox2.Text);



                if (richTextBox2.Text == a1)
                {
                    MessageBox.Show("-c can't be used as a raw command, it is used to define when another command is being used. Try -c r to run the game...");
                }
                else if (richTextBox2.Text == a2)
                {
                    System.Diagnostics.Process.Start("Arcanists.jar");

                }
                else if (richTextBox2.Text == a3)
                {
                    foreach (System.Diagnostics.Process myProc in System.Diagnostics.Process.GetProcesses())
                    {
                        if (myProc.ProcessName == "javaw")
                        {
                            myProc.Kill();
                        }
                    }
                }
                else if (richTextBox2.Text == a4)
                {
                    MessageBox.Show("Type -c r to run the game");
                }
                else
                {
                    listBox2.Items.Add("*!Invalid Command!*");
                }

        }
    }
Layne3
  • 71
  • 1
  • 2
  • 7
0

Use your clicks to focus to your text input via a text box. Your going to need a richtextbox for output and a text box for input like a video game with a console option

Ray
  • 1