With the command"NumericUpDown Control" I would run a command based on the number selected in NumericUpDown Control

example
If I select the number 5 in the Control NumericUpDown instruction must be repeated
5 times/x5

PS: sorry for my English but I am Italian

Recommended Answers

All 12 Replies

Hello, bbman.
What have you done so far? What's not working or what's giving you unexpected/undesired results?

this is one part of my project

private void button1_Click(object sender, EventArgs e)
        {
            String indirizzo = textBox1.Text;
            webBrowser1.Navigate(new Uri (indirizzo));
            System.Diagnostics.ProcessStartInfo p = new System.Diagnostics.ProcessStartInfo(@"C:\Program Files\Visit Inject\ip.exe");
            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.StartInfo = p;
            proc.Start();
            proc.WaitForExit();
        }

      

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{

// there I would like to enter the command to repeat the instruction es(x5)
}

        {

you mean, something like this?

for(int i = 0; i < REPEAT_TIMES; i++){
    //some work to repeat "REPEAT_TIMES" times 
}

I want the instruction

String indirizzo = textBox1.Text;
            webBrowser1.Navigate(new Uri (indirizzo));
            System.Diagnostics.ProcessStartInfo p = new System.Diagnostics.ProcessStartInfo(@"C:\Program Files\Visit Inject\ip.exe");
            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.StartInfo = p;
            proc.Start();
            proc.WaitForExit();

repeats based on the number selected in NumericUpDown Control

So what's the problem? I gave you a solution. You just need to pick up a number of times to repeat from your control and place your work at the certain place.

thanks
the only problem is that if I increase the NumericUpDown control ... you run the instructions, but I would like that if I click button1, the instructions are executed according to the times selected with the command NumericUpDown

Ok, we're one step closer! :)
Now, take a look at NumericUpDown Class and replace the "//THERE?????" with a value from your control.

thanks
the only problem is that if I increase the NumericUpDown control ... you run the instructions, but I would like that if I click button1, the instructions are executed according to the times selected with the command NumericUpDown

So if you want it to execute after button click, why wont you put all this into a button click event, rather than in a numericUpDown1_ValueChanged? ;)

ok I'm stupid I give up
thanks and sorry

oh, c'mon! :) We'll get this to work, just put some effort (don't expect for a ready-made solution ;))

Tomorrow I'll read some tutorials and try to finish that instruction
Also I prefer to figure out alone or with some help rather than cut and paste :icon_cheesygrin:
I will follow your advice "button click event" and if I can find the solution I'll post

commented: Good approach .. waiting for a good news from you :) +7
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.