You are viewing our Forum Archives. To view or take place in current topics click here.
Spawn Text Into A Textbox
Posted:
Spawn Text Into A TextboxPosted:
Status: Offline
Joined: Aug 01, 201410Year Member
Posts: 27
Reputation Power: 1
how do i spawn text into a textbox? like if i have a list of stuff to put in it, at random i want to keep spawning in different ones? so remove the current one, spawn the new one, then over everytime i press a button. thanks
#2. Posted:
Status: Offline
Joined: Apr 15, 201113Year Member
Posts: 614
Reputation Power: 83
What language? It really does help if you use relevant vocabulary though please do enlighten me as to what you think "spawning text" means?
I could take a stab in the dark in that you are referring to JavaScript??
[ Register or Signin to view external links. ]
- At random intervals replaces the textarea value to a random element in an array
- Replaces the textarea value with a random element in an array when clicked
Last edited by iyop45 ; edited 1 time in total
I could take a stab in the dark in that you are referring to JavaScript??
[ Register or Signin to view external links. ]
- At random intervals replaces the textarea value to a random element in an array
- Replaces the textarea value with a random element in an array when clicked
Last edited by iyop45 ; edited 1 time in total
- 0useful
- 0not useful
#3. Posted:
Status: Offline
Joined: Aug 01, 201410Year Member
Posts: 27
Reputation Power: 1
iyop45 wrote What language? It really does help if you use relevant vocabulary though please do enlighten me as to what you think "spawning text" means?
I could take a stab in the dark in that you are referring to JavaScript??
[ Register or Signin to view external links. ]
no c#, and i mean were you press and button, and it then inputs at random a line from one of my many lines of text?
- 0useful
- 0not useful
#4. Posted:
Status: Offline
Joined: Apr 15, 201113Year Member
Posts: 614
Reputation Power: 83
ZakHud wroteiyop45 wrote What language? It really does help if you use relevant vocabulary though please do enlighten me as to what you think "spawning text" means?
I could take a stab in the dark in that you are referring to JavaScript??
[ Register or Signin to view external links. ]
no c#, and i mean were you press and button, and it then inputs at random a line from one of my many lines of text?
using System;
using System.IO;
class abc
{
private void button1_Click(object sender, EventArgs e)
{
string path = @"c:\abc.txt";
if (!File.Exists(path))
{
string[] lines = File.ReadAllLines(path);
Random rand = new Random();
string randomLine = lines[rand.Next(lines.Length)];
textBox1.Text = randomLine;
}
}
}
I haven't tested it as I don't have access to my computer at the moment. ( It is broken )
I am not spoon speeding anymore, If you can't find any approach from my input then it's at your loss.
- 1useful
- 0not useful
You are viewing our Forum Archives. To view or take place in current topics click here.