I recommend you learn to use google, and buy/read a book on how to use C#. It's obvious to me that you're yet another outsourced worker, who has taken a job they know absolutely nothing about ,and are hoping we'll do your work for you. We try to help people who show some sign of making an effort.
OK, and what is the issue ? As someone else said more explicitly than I did, you can use DateTime.Now to get years from this year going back, or going forward. The obvious thing to do is to create a list of ints, and use a loop to create them, then make that your data source.
Hi, I'm a new programer in c# and I want some help about the helpprovider control in .Net. when I set the helpstring in persian language and run the program it shows me unreadable charachter!!!!
i search about it and i found some articles about CHM files that attaches to the program but I want use this control that can be used every where in the form and helps users to introduces each control in my form and some more. if anyone can helps me, i really appricateeeeeeeeeeeeeeeeeee
Notice how I'm the only one who replied ? That's because you're one of the growing list of retards who take a job, have no idea how to do it, and post broad questions that can't possibly be answered in a forum reply, without first using google.
void b_Click(object sender, EventArgs e)
pb.Value = 0;
int inc = Convert.ToInt32(100 / 5);
DialogResult result = MessageBox.Show("Do you want to continue", "Header", MessageBoxButtons.YesNo);
if (result == DialogResult.Yes)
for (int i = 0; i <= 4; i++)
pb.Value = pb.Value + inc;
In actual problem I have a code which is taking around 300ms for each iteration in the for lood thats why i placed System.Threading.Thread.Sleep(600) in the for loop.
Now the problem is When the MessageBox appears and I click on Yes Button,
Out of 10 times ,3 times the MessageBox still remains visible even after clicking on the Yes button against the actual behavior of becoming invisible/hiding immediately after clicking the Yes button of MessageBox.
Note that On my friend machine this problem does not exists.
If you want your UI to always respond when your code is doing some calculations, you need to do those calculations in another thread. Application.DoEvents() between your message box and your other code is a hack that may work.
Most probably, as you said your code works fine in your frnds computer. Might be your computer is getting hanged. And as you are keeping a sleep command immediately after the message box. What might be happening that when you fire a sleep command , the thread on which your whole application is working is paused. and hence the message box might not be able to get invisible , as the application is in sleep mode..
Or one more thing, Do one thing , keep any integer variable and show it in the message box displaying no of times message box is opened. This might give you an idea that after pressing YES , might be the new message box have appeared but because of very short time span , you might not be able to visualise the changes. .