how do i receive two separate inputs from the same text box?

here is what i have so far:

c1 = textBox1.Text;
textBox1.Clear();
c2 = textBox1.Text;

Recommended Answers

All 4 Replies

Are you entering both the values at the same time or one after the other?

one after the other. the user is supposed to enter a value, press a button, then enter the next value in the same text box.

On the click event of the button you can capture the data and clear it.
For eg.

c1 = Textbox1.text;
Textbox1.clear();

Use List<String> to hold one or more values.

List<string> data=new List<string>();
private void button1_Click(object sender, EventArgs e)
        {
             data.add(TextBox1.Text)
             TextBox1.Cler();
        }

Get value/text from data collection:

String c1=data[0];
String c2=data[1];
commented: Right! +8
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.