0
votes

I am importing xml document to econnect method(Microsoft Dynamic GP). it is taking few minutes(10 M) to import the file. so i need to show progress bar while doing import.

In form load event I am submitting xml file.

But problem is form is showing after submit the xml file. I need to show the Progressbar form (70%) before sumbiting xml file. And submiting xml file i have to show progress bar full (100%).

Let me know how can i show.....

              Form BarFormobj = new Form();
                BarFormobj.Width = 250;
                BarFormobj.Height = 150;
                BarFormobj.StartPosition = FormStartPosition.Manual;
                BarFormobj.Location = new Point(450, 200);
                BarFormobj.Text = "Invoice Date";

                BarFormobj.Load += new EventHandler(BarFormobj_Load);                    
                pBar.Location = new System.Drawing.Point(20, 20);
                pBar.Name = "progressBar1";
                pBar.Width = 200;
                pBar.Height = 30;

                pBar.Minimum = 0;
                pBar.Maximum = 100;
                pBar.Value = 70;   
                BarFormobj.Controls.Add(pBar);

                BarFormobj.ShowDialog();

                    pBar.Value = 100;
                    BarFormobj.Controls.Add(pBar);

              MessageBox.Show("Invoices have been successfully created");

static void BarFormobj_Load(object sender, EventArgs e)

    {          

      eConcall.CreateTransactionEntity(connStr, xmlDoc);  // here i am submitting xml documnet to Econnect. 
    }
1
Try to move your submitting code to the Shown event instead of LoadSteve
Thanks for your reply, i have written submitting code under ShowDialog() method. But control is going after closing progressbar form. I don't want to close the form before complete 100% Progress bar.Kavitha
ShowDialog() is a blocking call. You can't write code to handle the progressbar after the ShowDialog() because, the form is closed/hidden when the call from ShowDialog() returns.Steve
Thanks Steve, Is any other way to show full progress bar....Kavitha
Use the Show() method, this exits immediately and you could code your progressbar after the call, but in this case you, if you need to close automatically the form, you need to keep the instance of the form and close it from code.Steve

1 Answers

0
votes

The very simple solution is to move the code setting the progress bar vaue to the BarFormobj_load event handler right after the code submitting the XML file.