Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
12
Reply
Do not allow twice values into a textbox
Israel
Aug 28 2015 8:52 PM
599
Reply
Hi!
I have one combobox with a textbox.
Inside of my combobox I have three items (Morning, afternoon, goodnight). Then each selection is displayed into the textBox.
What I need to do?
When I select "morning" for example I would like that even I selected the second way its not should appear twice into the textbox (only once). Its allow to appear again ONLY when the textbox its clean it.
My code:
private void cbxChoice_SelectedIndexChanged(object sender, EventArgs e)
{
switch (cbxChoice.SelectedIndex)
{
case 0:
//Morning
textDisplay.Text += "\n" + Environment.NewLine + cbxChoice.Text + Environment.NewLine + ",";
textDisplay.clear();
break;
case 1:
//Afternoon
textDisplay.Text += "\n" + Environment.NewLine + cbxChoice.Text + Environment.NewLine + ",";
textDisplay.clear();
break;
case 2:
//Night
textDisplay.Text += "\n" + Environment.NewLine + cbxChoice.Text + Environment.NewLine + ",";
textDisplay.clear();
break;
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
12
)
Next Recommended Forum
getting invalid identifer error when fetching the data from
connection object