.net

Problem with DataView Sort

I am trying to fetch data from DB and loading the DB with the values fetched. Later I am sorting the Data in the Table based on Name, then I want to bind it with a CheckedListBox However, when I am trying to use the DataView class as shown in the code below, I see a flickering occuring while the displaying data and once all data is sort...

Format Removable media with c# programming

I want to format (FAT32) removable drive with c# programming. In the internet I found a way, but the problem is that it opens the generic windows format program. But I want to do it with C# only and no built in windows support. My method is: // FAT32 Format Button click event [DllImport("shell32.dll")] static extern uint SHFormatDrive(...

In .Net and c# DataTable.Select(string, string) method Question

What if we write filterExpression equal to null or "" ? Will all the rows be selected? ...

Label.Text / Convert.ToString And String.Format Help / Thousand Separator

I have a label that i want to show it's Text("1234567") Like A Number With Thousand Separator// how can i do this with : Lable1.Text = string.Format(.....; Lable1.Text = Convet.ToString(.....; please explain these two. ...

How can I prevent windows from showing in .NET?

I'm currently working on an access control program in C# and I've come across the problem of blocking windows. The original idea I've come up with is rendering a plain black form over the position given by the IntPtr window handle of the process. The problem within that is updating the form's position smoothly and z-index of the position...

Should Dispose() or Finalize() be used to delete temporary files?

I have a class that makes use of temporary files (Path.GetTempFileName()) while it is active. I want to make sure these files do not remain on the user's hard drive taking up space after my program is closed. Right now my class has a Close() method which checks if any temporary files used by the class still exist and deletes them. Would...

detect selected text

I m developing winform application with C#.Net. How can reach selected text with mouse? Text area is Label Control. ...

Is the Optional Parameter in C# 4 Backwards Compatible?

I am curious to know that whether optional parameter introduced in C#4 is backward compatible or not? Let me clarify my question with a simple example. Suppose I write the following code in C#4 on .Net2 in VS2010: public void Foo(int val1, int val2, int val3 = 5){ .... } Now I compiled the code, make a dll and reference it to a C#2 /...

C# .NET proper event subscribing and un-subscribing

I have an application that runs continuously, it creates and destroys classes some of which have events like mouse click events and the like... First question is what is the proper way to unsubscribe? If the subscribe looks like this: Panel1.MouseClick += new MouseEventHandler(Action_MouseClick); is it proper to unsubscribe like this...

Does anyone know how to disable "code" blocks in WMD Markdown and MarkDownSharp

I'm wondering if anyone can help show me how to completely disable code blocks in WMD Markdown as well as in MarkDownSharp? In my implementation of markdown, there is no reason for the user have the ability to insert code. I have removed the editor button, but there is still the ability to insert the 4 spaces for a code block. ...

Verifying authenticode signature upon execution of .NET app

I feel like I'm missing something obvious here, but I don't see it written anywhere. I sign my executables using an Authenticode certificate, but as I've started to learn a bit more about it, I am questioning the value as-is. A signed exe has a digital certificate that shows as being a "valid" certificate. When you download such a fi...

xmlaclient.Discover(MDSCHEMA_MODULES,...) System out of memory exception

When I try to drill down into a cube in our client application, I use xmlaclient.Discover method to discover the SSAS metadata. When I've drilled down to the about the 7th level I get a system out of memory exception. The stack trace is as below- This is running on a Windows 2008 server, 2008 ssas server and the application is on a windo...

ContextSwitchDeadlock with WCF communication

I have a system consisting of two parts: WCF server (console) and client (WinForms). Server publishes a service for remote access to the database, and client connects. Everything runs smoothly, client is able to read database documents, attachments and so forth. However, after 60 seconds running in debugger, the following client problem ...

Should variable declarations always be placed outside of a loop?

Is it better to declare a variable used in a loop outside of the loop rather then inside? Sometimes I see examples where a variable is declared inside the loop. Does this effectively cause the program to allocate memory for a new variable each time the loop runs? Or is .NET smart enough to know that it's really the same variable. For ex...

Can I run my .NET app offilne using the Silverlight UI?

I'm working on an interface for an app that I run locally (this needs to be able to run offline), and I want to use Silverlight's UI. I use certain references (specifically, Microsoft.Win32) in my .NET app which are not supported by the Silverlight framework, however. I want to not only use these assemblies, but somehow put a Silverlig...

How to check for pre-requisite before bootstrappers are run within wix

I have defined a SQL server bootstrapper in the .wixproj file: <BootstrapperFileV7 Include="Microsoft.Sql.Server.Express.10.0"> <ProductName>Sql Server Express</ProductName> </BootstrapperFileV7> And the pre-requisite check in the .wxs file: <PropertyRef Id="NETFRAMEWORK35_SP_LEVEL" /> <Condition Message="This setup requires the .N...

Trading Platform built on Silverlight?

I've had an idea for some time now to write a trading platform application similar to think or swim in Silverlight. First of all is it something that one person can do in a reasonable time-frame? Ok next question is how would the performance of the Silverlight be running such a memory intensive application? Will it scale? Nearly all t...

How to use DrawThemeTextEx in WPF

Hi, I'm working on an application that displays text on Aero Glass. To make it readable I used a OuterGlowBitmapEffect, but, as also described here this is no longer possible in .NET 4 and the DropShadowEffect won't work for Glass either. While searching for a solution I came across the native DrawThemeTextEx in DWMApi, but all examples...

Master-Detail Split Between Two View Models: Where to put cancel command logic?

Hello, Master section of window contains a DataGrid. Details section displays a form allowing editing of record currently selected in master's DataGrid. Grid's SelectedItem is bound to the master vm. When that property changes, the master vm creates a new EditViewModel, exposing it via a property. The details section of the view uses th...

Performance of .Net function calling (C# F#) VS C++

Since F# 2.0 has become a part of VS2010 I take an interest in F#. I wondered what's the point of using it. I'd read a bit and I made a benchmark to measure functions calling. I have used Ackermann's function :) C# sealed class Program { public static int ackermann(int m, int n) { if (m == 0) return n + 1; ...