471,093 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,093 software developers and data experts.

Data not going into Excel from Form button - Do I need a thread

JM
Hi

I have created a Windows Form that takes input. When the Run button is
pressed the form is disabled and the code checks some files and inputs the
data into an Excel worksheet (that is hidden so that I cannot watch as it
gets filled up). When it is done it saves the Excel file.

I find that if I go into another program while it's trying to work on the
Excel spreadsheet that not all of the data appears (missing data!). If I
click the Run button and then do nothing (don't touch the keyboard) all of
the data appears in the spreadsheet no problem.

What the heck am I missing??? I don't have the Minimize and Maximize
buttons on the Windows Form but that should not make a difference right? Do
I need to make a thread or something?
Nov 17 '05 #1
2 1641
> I find that if I go into another program while it's trying to work on the
Excel spreadsheet that not all of the data appears (missing data!). If I
click the Run button and then do nothing (don't touch the keyboard) all of
the data appears in the spreadsheet no problem.
Are you using another program to access the Excel spreadsheet as your
program is writing information to it? If this is the case there is probably
a lock on the file by one of the applications; most likely your app is not
locking the file and when Excel opens it will lock it and no further data
can be written to it your program should error out. Is your program
crashing or reporting any errors?

"JM" <JM@discussions.microsoft.com> wrote in message
news:B1**********************************@microsof t.com... Hi

I have created a Windows Form that takes input. When the Run button is
pressed the form is disabled and the code checks some files and inputs the
data into an Excel worksheet (that is hidden so that I cannot watch as it
gets filled up). When it is done it saves the Excel file.

I find that if I go into another program while it's trying to work on the
Excel spreadsheet that not all of the data appears (missing data!). If I
click the Run button and then do nothing (don't touch the keyboard) all of
the data appears in the spreadsheet no problem.

What the heck am I missing??? I don't have the Minimize and Maximize
buttons on the Windows Form but that should not make a difference right?
Do
I need to make a thread or something?

Nov 17 '05 #2
JM
If I don't touch the computer while it is processing it works fine. Once I
start to work with other programs it starts to drop the data from Excel. No
Errors or anything. I just think that when I do other work on the computer
the Excel workbook no longer has the focus.

"Alex Passos" wrote:
I find that if I go into another program while it's trying to work on the
Excel spreadsheet that not all of the data appears (missing data!). If I
click the Run button and then do nothing (don't touch the keyboard) all of
the data appears in the spreadsheet no problem.


Are you using another program to access the Excel spreadsheet as your
program is writing information to it? If this is the case there is probably
a lock on the file by one of the applications; most likely your app is not
locking the file and when Excel opens it will lock it and no further data
can be written to it your program should error out. Is your program
crashing or reporting any errors?

"JM" <JM@discussions.microsoft.com> wrote in message
news:B1**********************************@microsof t.com...
Hi

I have created a Windows Form that takes input. When the Run button is
pressed the form is disabled and the code checks some files and inputs the
data into an Excel worksheet (that is hidden so that I cannot watch as it
gets filled up). When it is done it saves the Excel file.

I find that if I go into another program while it's trying to work on the
Excel spreadsheet that not all of the data appears (missing data!). If I
click the Run button and then do nothing (don't touch the keyboard) all of
the data appears in the spreadsheet no problem.

What the heck am I missing??? I don't have the Minimize and Maximize
buttons on the Windows Form but that should not make a difference right?
Do
I need to make a thread or something?


Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Matthew Wieder | last post: by
9 posts views Thread by Brian Hanson | last post: by
1 post views Thread by Brian Conklin | last post: by
10 posts views Thread by Doug Bell | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.