I have a textbox, a listbox and a button on a winforms. I want the user to input some text into the textbox and when I click the button it outputs to the listbox, but I want the text seperated by a comma. For example if I enter Monday, Tuesday, Wednesday into the textbox, I want it to display in the listbox as:
Monday,
Tuesday,
Wednesday
Could anyone help?
I have managed to add the text from the textbox to the listbox but can't work out how to split the text by comma.I know that the Split method is used but unsure how to implement it
Thanks
private void btnSplit_Click(object sender, EventArgs e)
{
listboxListItems.Items.Add(txtboxUserInput.Text);
}
question from:https://stackoverflow.com/questions/66054922/how-to-split-textbox-text-to-listbox-c-sharp