private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
int sum = 0;
for (int i = 1; i <= 100; i++)
{
Thread.Sleep(100);
sum = sum + i;
// Calling ReportProgress() method raises ProgressChanged event
// To this method pass the percentage of processing that is complete
backgroundWorker1.ReportProgress(i);
if (i == 100)
{
e.Cancel = true;
// Reset progress percentage to ZERO and return
backgroundWorker1.ReportProgress(100);
return;
}
// Check if the cancellation is requested
if (backgroundWorker1.CancellationPending)
{
// Set Cancel property of DoWorkEventArgs object to true
e.Cancel = true;
// Reset progress percentage to ZERO and return
backgroundWorker1.ReportProgress(0);
return;
}
}
}
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
progressBar1.Value = e.ProgressPercentage;
label1.Text = e.ProgressPercentage.ToString() + "%";
}
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
if (e.Cancelled)
{
label1.Text = "Processing cancelled";
f.Show();
}
else if (e.Error != null)
{
label1.Text = e.Error.Message;
}
else
{
label1.Text = e.Result.ToString();
}
}
private void Form1_Load(object sender, EventArgs e)
{
if (!backgroundWorker1.IsBusy)
{
// This method will start the execution asynchronously in the background
backgroundWorker1.RunWorkerAsync();
}
}
private void button1_Click(object sender, EventArgs e)
{
if (!backgroundWorker1.IsBusy)
{
// This method will start the execution asynchronously in the background
backgroundWorker1.RunWorkerAsync();
}
}
private void button2_Click(object sender, EventArgs e)
{
if (backgroundWorker1.IsBusy)
{
// Cancel the asynchronous operation if still in progress
backgroundWorker1.CancelAsync();
}
}
My Name Is Salman Masood , I am Computer Science &Amp; Maths Graduate from University of Karachi, Pakistan , Teaching Is My Passion and My Aim Is to Deliver All My Knowledge among Those Students Who Can'T Afford Tutors or Expensive Institute Fees. I Will Be Keep Sharing My All Knowledge and Information with You .... Remember Me in Your Prayers !
Thursday, 12 October 2017
one to many relationship in sql
create table department
(
dept_id int identity primary key,
dept_name nvarchar(20) not null
)
insert into department values('CS')
insert into department values('MATHS')
insert into department values('PHYSICS')
insert into department values('CHEMISTRY')
insert into department values('GEOLOGY')
SELECT * FROM department
create table TEACHERS
(
T_id int identity primary key,
T_name nvarchar(20) not null
)
INSERT INTO TEACHERS VALUES('SALMAN')
INSERT INTO TEACHERS VALUES('ALI')
INSERT INTO TEACHERS VALUES('AHSAN')
INSERT INTO TEACHERS VALUES('AHMED')
INSERT INTO TEACHERS VALUES('BILAL')
INSERT INTO TEACHERS VALUES('ZOHAIB')
INSERT INTO TEACHERS VALUES('SANA')
INSERT INTO TEACHERS VALUES('KHALID')
INSERT INTO TEACHERS VALUES('KHIZRA')
INSERT INTO TEACHERS VALUES('SAMI')
INSERT INTO TEACHERS VALUES('UZAIR')
INSERT INTO TEACHERS VALUES('RAZA')
INSERT INTO TEACHERS VALUES('YASIR')
SELECT * FROM TEACHERS
CREATE TABLE T_D_RECROD
(
S_ID INT IDENTITY PRIMARY KEY,
FK_T INT unique FOREIGN KEY REFERENCES TEACHERS(T_id),
FK_d INT FOREIGN KEY REFERENCES department(dept_id)
)
insert into T_D_RECROD values(1,1)
insert into T_D_RECROD values(3,1)
insert into T_D_RECROD values(5,1)
insert into T_D_RECROD values(7,1)
insert into T_D_RECROD values(9,1)
insert into T_D_RECROD values(11,1)
insert into T_D_RECROD values(2,3)
insert into T_D_RECROD values(4,4)
insert into T_D_RECROD values(6,2)
insert into T_D_RECROD values(8,3)
insert into T_D_RECROD values(12,1)
select t.T_id,t.T_name,d.dept_id,d.dept_name from T_D_RECROD r inner join TEACHERS t on t.T_id=r.FK_T inner join
department d on d.dept_id=r.FK_d
Subscribe to:
Posts (Atom)
Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC
Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...
-
Load event: pictureBox3.Image = Image .FromFile( @"C:\Users\salman\Documents\Visual Studio 2013\Projects\WindowsFormsApplication3\W...