Solved

Excel Upload to datagrid

Posted on 2011-09-24
2
227 Views
Last Modified: 2012-05-12
Hi Team,

Iam trying to upload Employee timesheet excel which consists of 12000 - 15000 records in datagrid in Windows Forms using VB.net.

While Uploading I want to verify that Id column in excel is an Active employee Id with database, as data is huge, screen is getting white [ as in busy process ] as it does reading and binding.

1. How I can make screen while binding active, how to show as it is progressing without system getting hanged. ?

2. If I do first upload of excel it is taking 1 min time, then if I do verify for employee id then screen is getting white as in busy process ?

Please suggest.

Dlsuser.
0
Comment
Question by:dlsUser
2 Comments
 
LVL 2

Accepted Solution

by:
Lord_Death earned 250 total points
ID: 36594532
I Assume you have a loop for reading your excel file so :

you have to call the event handler for form to make it active.
Application.DoEvents(); is the line you have to write before your loop.
and update your progress bar.


this.progressBar1.Visible = true;
this.progressBar1.Minimum = 1;
this.progressBar1.Maximum = worksheet.Cells.MaxDataRow;
this.progressBar1.Value = 1;
this.progressBar1.Step = 1;
 // Loop through all files to copy.
 for (int i = 1; i <= worksheet.Cells.MaxRow; i++)
{
      Application.DoEvents();
     this.labelProgress.Text = worksheet.Cells[i, 0].Value.ToString() + " " + worksheet.Cells[i, 1].Value.ToString();
     this.progressBar1.PerformStep();
}//~For FileRows
0
 

Author Closing Comment

by:dlsUser
ID: 36594560
Thanks Alottttttt
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now