دوست عزیز هرچی راه خودش رو داره اگه قراره یک کوئری رو دیتابیس بزنی خب باید استایل پروگرس بارت رو تغییر بدی اما مثلا برای کپی میشه به نحوی کار کرد که عملیات رو با پروگرس بار نشون داد
مثلا
public static void CopyFile(string FileSource, string FileDestination, ProgressBar progressBar1)
{
int NumRead;
long FileLength;
System.IO.FileStream From = new System.IO.FileStream(FileSource, System.IO.FileMode.Open);
System.IO.FileStream To = new System.IO.FileStream(FileDestination,
System.IO.FileMode.CreateNew);
byte[] buffer = new byte[1024];
FileLength = From.Length;
progressBar1.Minimum = 0;
progressBar1.Maximum = (int)FileLength;
while (FileLength > 0)
{
System.IO.BinaryReader Reader = new System.IO.BinaryReader(From);
NumRead = Reader.Read(buffer, 0, 1024);
FileLength = FileLength - NumRead;
System.IO.BinaryWriter Writer = new System.IO.BinaryWriter(To);
Writer.Write(buffer, 0, NumRead);
FileInfo aaaa = new FileInfo(FileSource);
Int64 a = aaaa.Length;
Int64 a1 = a /= 1000;
//MessageBox.Show(a1.ToString());
progressBar1.Maximum = int.Parse(a1.ToString());
progressBar1.Value = progressBar1.Value + (NumRead /= 1000);
Writer.Flush();
}
From.Close();
To.Close();
if (progressBar1.Value > 99)
{
progressBar1.Value = 0;
MessageBox.Show("Copy Finished successfuly");
}
}