Click here to Skip to main content
15,886,199 members
Home / Discussions / C#
   

C#

 
AnswerRe: Helpprovider control in c# Pin
Christian Graus8-Mar-09 19:57
protectorChristian Graus8-Mar-09 19:57 
General[Message Deleted] Pin
sipora8-Mar-09 22:14
sipora8-Mar-09 22:14 
GeneralRe: Helpprovider control in c# Pin
Christian Graus8-Mar-09 23:18
protectorChristian Graus8-Mar-09 23:18 
Question[Message Deleted] Pin
bobby20098-Mar-09 19:52
bobby20098-Mar-09 19:52 
AnswerRe: How to create a ExecuteNonquery console app with output parms Pin
Christian Graus8-Mar-09 19:58
protectorChristian Graus8-Mar-09 19:58 
GeneralRe: How to create a ExecuteNonquery console app with output parms Pin
bobby20099-Mar-09 10:29
bobby20099-Mar-09 10:29 
AnswerRe: How to create a ExecuteNonquery console app with output parms Pin
_Maxxx_8-Mar-09 20:34
professional_Maxxx_8-Mar-09 20:34 
QuestionMessage Box Challenge Pin
Sandeep Kalra8-Mar-09 19:19
Sandeep Kalra8-Mar-09 19:19 
Hi All


Check the code first


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MessageBoxChallenge
{
public partial class Form1 : Form
{
private ProgressBar pb = new ProgressBar();
private Button b = new Button();

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
pb.Value = 5;
pb.Visible = true;
pb.Left = 20;
pb.Top = 30;
pb.Style = ProgressBarStyle.Blocks;
this.Width = 500;
pb.Width = 400;
this.Controls.Add(pb);



b.Text = "click";
b.Top = 300;
b.Left = 50;
b.Visible = true;
this.b.Click += new EventHandler(b_Click);
this.Controls.Add(b);

}

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++)
{
System.Threading.Thread.Sleep(300);
pb.Value = pb.Value + inc;
}
}
else
{
this.Dispose();
this.Close();
}
}


}
}

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.

I do not know .Whats the actual problem is.

Please help me with any study material or code.

Thanks


Regards
THE SK
AnswerRe: Message Box Challenge Pin
Christian Graus8-Mar-09 19:59
protectorChristian Graus8-Mar-09 19:59 
AnswerRe: Message Box Challenge Pin
jaypatel5128-Mar-09 20:41
jaypatel5128-Mar-09 20:41 
AnswerRe: Message Box Challenge Pin
Samuel Cherinet8-Mar-09 21:43
Samuel Cherinet8-Mar-09 21:43 
AnswerRe: Message Box Challenge Pin
Luc Pattyn9-Mar-09 2:51
sitebuilderLuc Pattyn9-Mar-09 2:51 
QuestionHow to change the color of the file name Pin
egpuyos8-Mar-09 18:47
egpuyos8-Mar-09 18:47 
AnswerRe: How to change the color of the file name Pin
Abhijit Jana8-Mar-09 19:12
professionalAbhijit Jana8-Mar-09 19:12 
GeneralRe: How to change the color of the file name Pin
egpuyos8-Mar-09 21:40
egpuyos8-Mar-09 21:40 
AnswerRe: How to change the color of the file name Pin
Christian Graus8-Mar-09 20:00
protectorChristian Graus8-Mar-09 20:00 
GeneralRe: How to change the color of the file name Pin
egpuyos8-Mar-09 21:42
egpuyos8-Mar-09 21:42 
GeneralRe: How to change the color of the file name Pin
Dave Kreskowiak9-Mar-09 4:51
mveDave Kreskowiak9-Mar-09 4:51 
QuestionHow to skip system files and folders? Pin
sumit70348-Mar-09 18:39
sumit70348-Mar-09 18:39 
AnswerRe: How to skip system files and folders? Pin
Christian Graus8-Mar-09 20:01
protectorChristian Graus8-Mar-09 20:01 
GeneralRe: How to skip system files and folders? Pin
sumit70348-Mar-09 20:16
sumit70348-Mar-09 20:16 
GeneralRe: How to skip system files and folders? Pin
_Maxxx_8-Mar-09 20:38
professional_Maxxx_8-Mar-09 20:38 
Questionhow to change text of a textbox in password mode Pin
vinodkrebc8-Mar-09 18:09
vinodkrebc8-Mar-09 18:09 
AnswerRe: how to change text of a textbox in password mode Pin
Christian Graus8-Mar-09 20:02
protectorChristian Graus8-Mar-09 20:02 
AnswerRe: how to change text of a textbox in password mode Pin
jaypatel5128-Mar-09 20:45
jaypatel5128-Mar-09 20:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.