Does anybody know if there is a way to use the GetFiles method to retrive files using more than one search pattern (similar to what you can do with the OpenFileDialog class). For example, I want to use the GetFiles method to return all image files with the *.jpg, *.bmp, *.gif, etc extensions but it seem the method will only take one at a time and won't accept a string in the same format as the the FileDialog class. I thought about making multiple calls to GetFiles and putting the results into a stack and then popping them out one-by-one to sort them together into one array but I wanted to see if anybody could come up with an easier way.
ds is an in-memory DataSet, not associated with any database, a simple way to access what's in the DataGrid. grdProducts if of course a DataGrid.
The problem is that most of the times I run this code there's an unhandled NullReferenceException exception ("Object reference not set to an instance of an object").
Looking at the stack trace, it happens when the DataGrid is painting itself (after a WndPaint event). If I omit the grdProducts.Refresh() call in my code, I don't see any of my functions in the stack trace, but adding it makes the function in progress appear several levels down the trace (obvious).
But I have a suggestion is that as you are trying the clear the rows, clearing the table would have the same effect, so will clearing the Columns. Perhaps a cross reference is causing the null reference exception.
Hope this helps
Give them a chance! Do it for the kittens, dear God, the kittens!
GRRrrrr!!! I tried this on a hunch. Once I select my file, then I open it up and immediately close it. The time is EXACTLY the same, but just in different order. The OpenFile/Close takes about 2-1/2 seconds and my LoadEftsFile is back to normal again.
I guess I'm going to have to recreate the OpenFileDialog until they fix the bug. Unfortunately, they don't even have any problems reported with OpenFileDialog reported on their knowledgebase, nor do I have a couple of hundred bucks burning a hole in my pocket to report it.
Anyone know of a OpenFileDialog replacement control?
It definitely has something to do with it being on a networked drive.
If I move the entire directory over to my local drive, the 5 second load now becomes 1/4 second.
I'd say that it was only a problem with my network, if I couldn't replace OpenFileDialog with my own dialog and reduce the time so greatly. OpenFileDialog must be trying to verify something about the file by opening it, and with my slow network, I'm really seeing the effects of it.