Hello everyone,

I've got a question about vb.net and I hope one of you can help.

In the program I made, the user has to give some input in different textboxes and have to choose from different listboxes. This wil give an unique combination and create an certain output in a variable. The variable contains a multiple string output. This output is shown in a large textbox.

After the user has pass the first choises the user can continue to make a new output, and maybe again, so it is not clear how many times the user will do that. The new output also has to be shown in the textbox but with the first output. The different output, no matter how many, has to be combined so that the different output stands among each other.

How can I do that? Does every output has to be a different variable or is it possible to store the first output and combine it with the second output?

I hope that my question is clear.

Thanx in advance!

Sneaky Pete

Recommended Answers

All 6 Replies

Textbox1.Text = Textbox1.Text & newoutputvarible

If you use Richtextbox you can use append method for the same.

Thanx for the respond but it won't work.

Let me make things clear ( I hope ;)

When the user has given the input in the program, they click on a button "Generate".
This will generate the specific output which is associated with the correct user input.
This output is given in a large textbox. The textbox "txtOutput.Text" will show the varible "a", like this:

Me.txtOutput.Text=a

After the first time the user has generate this, he can do it another time.
The program will pass the whole procedure another time and when they click "Generate" again, the new output is given in the textbox txtOutput.Text and the previous one is overwrited.
But, I want the new input is displayed under the previous one.

Now my question is, how can i do that?
Is it possible to keep putting the outcome of the user is the varible "a" or do you have to make different varibles?
Can I do something with do while / until?

Hope one of you can give me an answer.

Thanx in advance!

Sneaky Pete

I would suggest having three textboxes. The top one (read only) is multi-line. The one just below that is where the user types the input. When the user presses ENTER or clicks GENERATE, the third textbox gets the output and the current input is appended to the multi-line textbox, then cleared from the input area. If you name them txtLog, txtInput and txtOutput you get (in the btnGenerate handler)

txtLog.Text &= txtInput.Text & vbCrLf
'calculate value of txtOutput.Text here
txtInput.Text = ""
txtInput.Focus()

Thanx again for the help but my problem isn't solved.

Is it possible to fill the variable continuous when the user hits the button "Generate".
Maybe with a do while / until?

Something like this:
When the user hits the button " Generate" the result is displayed through variable a in txtOutput. When the user hits the button " Generate" again the new result will be combined in a and displayed in txtOutput with the first en second result among each other. How often the user will generate is unknown.

So my idea was something like this:
Do when button "generate" is clicked
Until button "Clear" is clicked

Hope you can help!

Sneaky Pete

So my idea was something like this:
Do when button "generate" is clicked
Until button "Clear" is clicked

In such cases I use timer or static/global variable. Just change the value of the varible when you click clear and your loop will stop executing.

I havent understood what you are exactly trying to do maybe you should upload image of your form that might explain something more clearly.

It sounds like you are asking two mutually exclusive things. First you said

the new output is given in the textbox txtOutput.Text and the previous one is overwrited.

Now you are saying

the new result will be combined in a and displayed in txtOutput with the first en second result among each other

You should never ever put in a polling loop while waiting for the user to enter something. Instead, put your "Generate" code (or better yet, a call to a Sub to do this) in the TextChanged event handler for the input text box. That way the results get regenerated only when there is a change to the input.

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.