TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
alec
NA
86
57.5k
Background worker with input
Dec 7 2011 11:24 AM
I have a function
public void DataTableToExcel (DataTable DT)
{
Excel.Application ExcelApp = new Excel.Application();
ExcelApp.Workbooks.Add();
ExcelApp.Workbooks[1].Worksheets.Add();
Excel.Worksheet wSheet = ExcelApp.Workbooks[1].Worksheets[1];
for (int i = 1; i < DT.Columns.Count + 1; i++)
{
wSheet.UsedRange[1, i] = DT.Columns[i - 1].ColumnName.ToString();
}
wSheet.get_Range(ExcelColumnLetter(0) + "1", ExcelColumnLetter(DT.Columns.Count) + "1").Font.Bold = true;
for (int i = 0; i < DT.Rows.Count; i++)
{
for (int j = 0; j < DT.Columns.Count; j++)
{
wSheet.UsedRange[i + 2, j + 1] = DT.Rows[i][j].ToString();
}
}
ExcelApp.Visible = true;
}
and I want it as a backgroundworker as I want it in a different thread and to report its progress.
How do I make a backgroundworker with an input?
Reply
Answers (
2
)
Moving text out of the source file
Rewrite the code