.net-2.0

How to determine which version of Windows?

回眸只為那壹抹淺笑 提交于 2019-12-05 01:53:54
How to determine which version of Windows? WinXP, Vista or 7 etc. 32 or 64 bit? UPD: for .Net 2.0 - 3.5 You're looking for the Environment.OSVersion , Environment.Is64BitProcess , and Environment.Is64BitOperatingSystem properties. Before .Net 4.0, you can check whether the process is 64-bit by checking whether IntPtr.Size is 8 , and you can check whether the OS is 64-bit using this code : public static bool Is64BitProcess { get { return IntPtr.Size == 8; } } public static bool Is64BitOperatingSystem { get { // Clearly if this is a 64-bit process we must be on a 64-bit OS. if (Is64BitProcess)

How to determine whether SqlConnection is enlisted into a System.Transactions' tx or not?

旧巷老猫 提交于 2019-12-05 00:15:45
问题 When we using a transation from System.Transactions (creating TransationScope for an instance) by default all Sql-connections (System.Data.SqlClient.SqlConnection) (but is't also the true for Oracle.DataAccess.OracleConnection) are enlisted on opening. That's called auto-enlistment. Nice feature. But it can be turned off throught a connection string's parameter (enlist=false). In that case connection being opened wouldn't be enlisted. But it can be enlisted manually later. So my question is:

.NET Application broken on one PC, unhandleable exception

懵懂的女人 提交于 2019-12-05 00:03:08
问题 I have a .NET 2.0 application with nothing fancy in it. It worked until yesterday on every PC I installed or copied it to, no matter if 2.0, 3.0, 3.5 or 3.5 SP1 was installed, no matter if it was Win2000, XP or even Win7 (in total 100+ machines). Yesterday I did my normal installation procedure and wanted to start it one time to check if everything is working...and it wasn't. The program crashed hard leaving me with the uninformative "Do you wanna report this error?" dialog. The problem is an

Is it possible to initialise a New System.Collections.Generic.Dictionary with String key/value pairs?

匆匆过客 提交于 2019-12-04 23:52:30
Is it possible to create and initialise a System.Collections.Generic.Dictionary object with String key/value pairs in one statement? I'm thinking along the lines of the constructor for an array of Strings.. e.g. Private mStringArray As String() = {"String1", "String2", "etc"} In case this is turns out to be a syntactic sugar kind of thing, I'd prefer an answer that I can use in .Net 2.0 (Visual Studio 2005), and Visual Basic - though I'm curious if it's possible at all so don't let that put you off ;o) I don't think there is a way to do this out of the box in VB.NET 2, however you can extend

Implementing conditional in a fluent interface

穿精又带淫゛_ 提交于 2019-12-04 23:47:15
问题 I've been trying to implement a fluent interface for a set of rules in my system. What I am trying to accomplish is this TicketRules .RequireValidation() .When(quartType => quartType == QuartType.Before).TotalMilageIs(64) .When(quartType => quartType == QuartType.After).TotalMilageIs(128); However, I have trouble implementing the When conditional how I intended to be. Currently, I need to call When() twice like in this snippet: rules.When(param => param.Remarque == "Test").TotalMilageIs(100);

Exception error message with incorrect line number

不问归期 提交于 2019-12-04 22:33:39
问题 When an exception is thrown in an Asp.Net web page, an error message is displayed with the complete stack trace. Example below: Stack Trace: IndexOutOfRangeException: Index was outside the bounds of the array. MyNameSpace.SPAPP.ViewDetailsCodeBehind.LoadView() +5112 MyNameSpace.SPAPP.ViewDetailsCodeBehind.Page_Load(Object sender, EventArgs e) +67 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13 System.Web.Util.CalliEventHandlerDelegateProxy

Updating images in resource section of an exe (in c#/C)

二次信任 提交于 2019-12-04 19:38:54
问题 I have few images embedded in my executable in resource section. I followed these steps to create my executable: Generated .resx file for all the images (.jpg) in a directory using some utility. The images are named image1.jpg, image2.jpg and so on. created .resources file from .resx file using: resgen myResource.resx Embedded the generated .resource file using /res flag as: csc file.cs /res:myResource.resources 4 I am accessing these images as: ResourceManager resources = new ResourceManager

read .xlsx without Excel and OLEDB

谁说胖子不能爱 提交于 2019-12-04 19:32:38
问题 Is there any chance to read .xlsx files in C# without having Excel installed on the client, and with no OLEDB connection available? The application is a Winforms project written in VS2005 C# .NET Framework 2.0. 回答1: How about this one here: EPPlus-Create advanced Excel 2007 spreadsheets on the server EPPlus is a .net library that reads and writes Excel 2007 files using the Open Office Xml format ( xlsx ). EPPlus supports ranges, cell styling, charts, pictures, shapes, named ranges,

Looking for a Visual Studio toolbox style navigation for desktop applications

心已入冬 提交于 2019-12-04 18:23:33
I'm working on a project that uses an MDI application with a navigation panel on the side. Currently it is a ListView. However, I would like to redesign it to be similar to the toolbox in visual studio 2008. If this is something that would require overriding the default paint method, it would also help if you could provide some good references on how to work with the paint method as I do not currently have any experience using it. Thanks in advance. You want to be using a ToolBox control. A few freely available ones are available the most friendly that i've used being by Gordon Robinson at:

Why can't you bind the Size of a windows form to ApplicationSettings?

扶醉桌前 提交于 2019-12-04 17:34:08
Update: Solved, with code I got it working, see my answer below for the code... Original Post As Tundey pointed out in his answer to my last question , you can bind nearly everything about a windows forms control to ApplicationSettings pretty effortlessly. So is there really no way to do this with form Size? This tutorial says you need to handle Size explicitly so you can save RestoreBounds instead of size if the window is maximized or minimized. However, I hoped I could just use a property like: public Size RestoreSize { get { if (this.WindowState == FormWindowState.Normal) { return this.Size