.net

Is there an easy way to determine the type of a file without knowing the file's extension?

I have a table with a binary column which stores files of a number of different possible filetypes (PDF, BMP, JPEG, WAV, MP3, DOC, MPEG, AVI etc.), but no columns that store either the name or the type of the original file. Is there any easy way for me to process these rows and determine the type of each file stored in the binary column...

Redirect stout from child process with .net

I'm using the following code System::Diagnostics::Process^ p = gcnew System::Diagnostics::Process(); p->StartInfo->FileName = "tnccmd.exe"; p->StartInfo->UseShellExecute = false; p->StartInfo->RedirectStandardInput = true; p->StartInfo->RedirectStandardOutput = true; p->Start(); System::IO::StreamWriter^ tnc_stdin = p->StandardInput; ...

Best method to show/hide hover popup window

I have a calendar control derived from DataGridView. A custom item hover event is already in place. When handling the event, I have the item that was hovered and the mouse location. What is the best method to show a pop-up window with detailed information about the item? Should I use a stripped down form (no titlebar,controlbox, etc) and...

Building .Net User Controls

I am currently building a .Net userform using C# and I am populating it with custom user controls. The controls each have an accessor that gets and sets the object that contains the data that the control will be populated with. At runtime, everything works great, but at design time I will get errors in the form designer. The errors ar...

Building hierarchy objects from flat list of parent/child

I have a list of items in a hierarchy, and I'm attempting to parse this list out into an actual hierarchy of objects. I'm using modified pre-order tree traversal to store/iterate through this list, and so what I have is a subset of the tree, including all children, ordered by their "left" value. For example, given the tree: Item A It...

How do you use LINQ with Sqlite

Would someone explain how to get LINQ working with Sqlite. ...

Downloadable/browsable version of the .NET Framework source code?

Now that the source code to the .NET Framework has been made available, is there any way to actually view it that doesn't involve using Visual Studio to step into a framework class? Several times now, I've been curious just how something works and wished I could peek at some code, but don't feel like putting together an application and d...

Do you have your own 'utils' dll and what do you keep there?

I can start with my own .NET dll. I have a dll I use in all my web projects (around 10) and I have util classes for FTP, zip, imageresizing, extensionmethods and a generic singleton class. I think it is a common practice and I just thought it would be interesting to hear what people put in their 'Utils' dlls EDIT: What small code gems ...

Can you ever have too many "protected virtual" methods?

Here's a question for those of you with experience in larger projects and API/framework design. I am working on a framework that will be used by many other projects in the future, so I want to make it nice and extensible, but at the same time it needs to be simple and easy to understand. I know that a lot of people complain that the .N...

How do I release sql express database?

I have a simple app that uses an SQL Express 2005 database. When the user closes the app, I want to give the option to back up the database by making a copy in another directory. However, when I try to do it, I get "The process cannot access the file '...\Pricing.MDF' because it is being used by another process." I closed the connecti...

Purchase Order System

Hi, I hope I don't get flagged for asking this here. Does anyone know of any Purchase Order system written in .net (opensource)? Thanks Edit ~ Web or desktop based is fine. If the source code is available (opensource) I could handle the integration. The backend can be SQL Server or mySQL, I'd prefer SQL Server. ...

Should .NET AnyCPU projects bind to Framework or Framework64 DLLs

I have a csproj that has a reference to the Framework64 version of System.Data. When I try to build using MSBUILD/TFS on another machine it fails as the 64-bit DLL doesn't exist. Should I bind to the Framework version, or will this limit me when running on 64-bit machines? Does .NET redirect the binding to use 64-bit when possible? ...

Tips / techniques for high-performance C# server sockets

I have a .NET 2.0 server that seems to be running into scaling problems, probably due to poor design of the socket-handling code, and I am looking for guidance on how I might redesign it to improve performance. Usage scenario: 50 - 150 clients, high rate (up to 100s / second) of small messages (10s of bytes each) to / from each client. ...

New asp.net charting controls - will they work with MVC (eventually)?

Scott Gu just posted about a new set of charting controls being distributed by the .NET team. They look incredible: http://weblogs.asp.net/scottgu/archive/2008/11/24/new-asp-net-charting-control-lt-asp-chart-runat-quot-server-quot-gt.aspx The million dollar question is ... will they work with MVC, and if so, when? ...

HTML last tag conditional match

I have two strings <EM>is <i>love</i></EM>,<PARTITION /> and <EM>is <i>love</i>,<PARTITION /> I want a regex to match the second string completely but should not match the first one. Please help. Note: Everything can change except the EM and PARTITION tags. ...

How do I solve the .NET CF exception "Can't find PInvoke DLL"?

This is to all the C# gurus. I have been banging my head on this for some time already, tried all kinds of advice on the net with no avail. The action is happening in Windows Mobile 5.0. I have a DLL named MyDll.dll. In the MyDll.h I have: extern "C" __declspec(dllexport) int MyDllFunction(int one, int two); The definition of MyDllFu...

Troubleshooting: Can't find a referenced unmanaged dll when invoking custom code via a Word code-behind

Context: I have a WPF App that uses certain unmanaged DLLs in the D:\WordAutomation\MyApp_Source\Executables\MyApp folder. I can double click the exe and everything runs. Next I have a Word 2007 code-behind project, that references relevant managed DLLs in the above folder and tries to do the same thing.. bring up the App UI. After ...

Connect to Pick Database using Odbc C# .Net

How to Connect to PickBasic database using Ole db driver .. I need it badly help me out ...

Dot net assembly viewer?

I have a dll that contains a dot net assembly - common intermediate language. The problem is that it's lacking documentation and I need to figure out the api like available classes, properties and methods, correct parameters to pass etc. Whats the best way to do this. I need some sort of viewer/inspector but I couldn't find any. Thanks...

Determine Number of Pages in a PDF File using C# (.NET 2.0)

Hi, I need to determine the number of pages in a specified PDF file using C# code (.NET 2.0). The PDF file will be read from the file system, and not from a URL. Does anyone have any pointers on how this could be done? Note, Adobe Acrobat Reader is installed on the PC where this check will be carried out. Thanks in advance for your ...