Click here to Skip to main content
15,886,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to for example when I click on button "NEXT" I've created in vb shows me always different text in textbox.. I want to show me text by order, when I click on button
Screenshot example
http://s14.postimg.org/hvfsmsv9t/Untitled.jpg[^]

third click
fourth click
etc..

so thats what I want to set up when I click button to show me text by order 1,2,3,4,5,6 etc and not randomly..

1 TextBox1.Text = "hi"
2 TextBox1.Text = "hello"
3 TextBox1.Text = "bla"
4 TextBox1.Text = "bl11a"
5 TextBox1.Text = "b11la"
6 TextBox1.Text = "bl111a"
etc....
Posted
Updated 27-Aug-14 7:57am
v3
Comments
[no name] 27-Aug-14 10:40am    
Okay... and did you have a question or a description of some sort of a problem that you have with the code that you have written?
[no name] 27-Aug-14 11:40am    
Seeing that I cannot see your code, read your mind or what you think putting a "Number before TextBox1.Text" would accomplish, I don't see how you think we could help you. How can we know what you are doing wrong when you do not show us what you are doing?

1 solution

So...set up your text as a array:
C#
private string[] lines = {"hi", "hello", "bla"};
private int next;

Then in your form load:
C#
TextBox1.Text = lines[0];
next = 1;
Then, your button code is just:
C#
TextBox1.Text = lines[next++];
if (next >= lines.Length) next = 0;
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900