I would like to make a tool on my form that would allow the user to add or remove textboxes using a [+] and [-] button. This should only be possible if the items "*.doc" or "*.docx" are selected in a ComboBox
.
I have tried this for the .doc thingy:
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
switch (cmbExtension.Text)
{
case "Other...":
string extensionName = Interaction.InputBox("Enter the new extension's name (for example *.txt): ", "New extension!");
File.AppendAllText(strPath, "\n" + extensionName);
// string extensionFunction = Interaction.InputBox("Enter the type of file it's supposed to be (for example Microsoft Word 2016): ", "Give us an idea.");
cmbExtension.Items.Clear();
LoadLines();
break;
case "*.doc":
btnPlus.Show();
break;
case "*.docx":
btnPlus.Show();
break;
default:
btnPlus.Hide();
break;
}
// As well as using similar code in these things, now empty:
if (cmbExtension.Text == "Other...")
{
}
if (cmbExtension.Text == "*.doc" || cmbExtension.Text == "*.docx")
{
}
}