How To Get User Input in C# Make VERY simple text app
Hope you all enjoy the video :-).
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 TextForTutorial
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
// Here, we get what the user types into the text box and convert it to a string, which we can perform actions with.
string text = richTextBox1.Text;
// Here, we take the text the user entered into the save location text box, and select as where we save and our file name. We then create the file and save the text from the rich textbox to it.
string savelocation = textBox1.Text;
System.IO.File.WriteAllText(savelocation, text);
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}