Theoretically you could simply attempt to open it with all file-format-reading-"procedures" you have available and see if any of them work.
But I would suggest to simply not bother. Other applications also just tell you something like "invalid file format". You can't take care of every eventuality. There's probably other stuff related to your application where investing your time instead would pay off more.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
I want to give to my application the possibility to drag and drop some kind of files from windows explorer inside my application.
But before the Drag and Drop operation be completed , I want to detect some details :
1. The user is Dragging a files or folders ?
2. What is the number of Files being dragged ?
3. What is the type of files being dragged ( for example the files may be Word files , Excel files...etc , so how to find the type of each file being dragged )
Hoe can I find these information before the drag and drop process is completed ?
I have only 1 problem :
In the DragEnter Event ,I have an instruction like this :
Dim ext = System.IO.Path.GetExtension(files(0))
IfNot ( ext.Equals(".xlsx", StringComparison.CurrentCultureIgnoreCase) Or ext.Equals(".xls", StringComparison.CurrentCultureIgnoreCase)) Then
e.Effect = DragDropEffects.None
The problem is that with this code , I'm expecting that all the drag operation that not contain .xls or .xlsx will be cancelled .
But I have a strange behavior : All the other files that doesn't have .xls or .xlsx are blocked to drag-drop , except the .txt files. The files with .txt extensions will still be drag drop.
Thank you !
I'm creating an application in VB.net 2013 , with entity Framework 6 and SQL server 2008R2.
I have noticed that every query that run for the first time ( against a specific entity ) , is too slow comparing with other queries.
For example :
Dim query= ( For t in context.Mytable1 where t.nr>5 select t).Tolist --------- Read only 1 records - 25 seconds
Dim query= ( For t in context.Mytable1 where t.nr<5 select t).Tolist --------- Read 400 records - 2 seconds
If I try to execute a query against another entity , it's the same scenario , the first time is too slow.
I have tried to use pre-generated views using a tool on NuGet , but there;s no difference.
You are not comparing like for like, the two queries are different. The first includes a where clause, which means the database must read every record and test for that condition. The second query just extracts all records.
it's just a mistake on typing. I have corrected in my question.
I try 2 queries with different condition , just to show that even the second query read more records , it's faster.
Of course , If I do the same query the first and the second time , the second time is faster.