.net-4.0

Why is VBA's VarType function saying this COM object is a string? (Object is instance of COM version of .NET's System.Object class.) Is it a bug?

允我心安 提交于 2019-12-19 07:39:34
问题 Question summary When I use VBA's VarType function, passing it an instance of the Object class available in a mscorlib.dll library reference (a .NET library reference), the value returned is 8 . According to VBA documentation here, this means the object is a string. This seems ridiculous. My question is why is the VarType function returning a string-type value for instances of this Object class from the .NET-library VBA reference? Is it a bug? Background information I suspect that the fact

ASP.NET Charting Control no longer working with .NET 4

旧巷老猫 提交于 2019-12-19 07:11:42
问题 I've just upgraded to .NET 4 and my ASP.NET Chart Control no longer displays. For .NET 3.5, the HTML produced by the control used to look like this: <img id="20_Chart" src="/ChartImg.axd?i=chart_5f6a8fd179a246a5a0f4f44fcd7d5e03_0.png&g=16eb7881335e47dcba16fdfd8339ba1a" alt="" style="height:300px;width:300px;border-width:0px;" /> and now, for .NET 4, it looks like this (note the change in the source path): <img id="20_Chart" src="/Statistics/Summary/ChartImg.axd?i=chart

Calling SHGetFileInfo in thread to avoid UI freeze

岁酱吖の 提交于 2019-12-19 06:45:15
问题 In a .NET 4.0 application (WPF) we're using SHGetFileInfo to obtain shell icons for a directory tree. Since this takes quite some time in some cases (i.e. for a network drive that is unreachable or for a floppy drive), we wanted to do this in a thread and then update the icon when it has been read in. The call is basically the same, it is now just executed within a thread. Because someone said that the thread must be STA for this to work, we used Thread rather than ThreadPool for testing,

how to avoid [Content_Types].xml in .net's ZipPackage class

笑着哭i 提交于 2019-12-19 05:08:37
问题 I wish to know if there is any way to avoid to have a [Content_Types].xml file inside the zip file while using .net's ZipPackage class. 回答1: No. Zip Packages are not (normal) Zip files. They must follow an imposed structure and contain that Content_Types.xml file in the root. ZipPackage = ZipArchive + Structure . If you want to create (and especially if you want to read) normal Zip archives you will need an extra library, there is no support in the BCL. See SharpZipLib (GPL) and DotNetZip 回答2

Need to optimise counting positive and negative values

血红的双手。 提交于 2019-12-19 05:00:58
问题 I need to optimise code that counts pos/neg values and remove non-qualified values by time. I have queue of values with time-stamp attached. I need to discard values which are 1ms old and count negative and positive values. here is pseudo code list<val> l; v = q.dequeue(); deleteold(l, v.time); l.add(v); negcount = l.count(i => i.value < 0); poscount = l.count(i => i.value >= 0); if(negcount == 10) return -1; if(poscount == 10) return 1; I need this code in c# working with max speed. No need

How to apply TextBox Control Template?

≯℡__Kan透↙ 提交于 2019-12-19 03:56:10
问题 I'm trying to simplify some code and improve my maintainability. I was initially seeking a way to have a text box aligned to the left, that can shrink and expand to a maximum value without centering inside a grid cell after reaching the maximum value. So I started out writing some code like this... <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="200" /> </Grid.ColumnDefinitions> <TextBox Text="Some text" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" MaxWidth=

How to query a DataTable in memory to fill another data table

依然范特西╮ 提交于 2019-12-19 02:58:35
问题 I am trying to update a Microsoft report. What it does is write out how many clients where excluded from a conversion process and for what reason. Currently the program writes all of the deleted clients back to the server then queries it back to fill a specialty table with the results. Here is the current query: SELECT DeletedClients.Reason, COUNT(DeletedClients.Reason) AS Number, CAST(CAST(COUNT(DeletedClients.Reason) AS float) / CAST(t.Total AS float) * 100 AS numeric(4, 1)) AS percentage

is it good to use BlockingCollection<T> as single-producer, single-consumer FIFO query?

元气小坏坏 提交于 2019-12-19 02:46:14
问题 I need single-producer, single-consumer FIFO query because I need to process messages in the order they received. I need to do this asynchronous because caller should not wait while I'm processing message. Next message processing should be started only when previous message processing is finished. Sometimes frequency of "receiving" messages is higher than frequency of "processing" messages. But in average I should be able to process all messages, just sometimes I have to "queue" pack of them.

Hide extensions in Vista/Windows 7 WPF FileDialog.Filter

假装没事ソ 提交于 2019-12-19 02:06:35
问题 I am using the WPF OpenFileDialog and SaveFileDialog in my .NET 4 WPF application. I use the Filter property to allow the user to set different file filters. In .NET 4, this uses the native file dialogs introduced with Windows Vista (if possible). However, these dialogs show the extensions which make up the file filters. Since some of these use quite a bit of extensions, this is quite ugly. For example, I have a filter Image files|*.bmp;*.dib;*.jpg;*.jpeg;*.jpe;*.jfif;*.gif;*.tif;*.tiff;*.png

UnhandledException not called when exception thrown in another thread

Deadly 提交于 2019-12-18 23:53:22
问题 According to the Microsoft documentation, when an unhandled exception occurs on a thread (from either the thread pool or created using the System.Threading.Thread class) the AppDomain.UnhandledException event should fire for the default AppDomain of the application. Here is the MSDN link which explains it after the second NOTE section. But I cannot reproduce this behaviour, as far as I can tell from my test application it never fires the UnhandledException on either the default AppDomain or