.net-2.0

COMException “Library not registered.” while using System.DirectoryServices

♀尐吖头ヾ 提交于 2019-12-24 10:59:38
问题 I have only just started received the following error in my windows forms application under .NET 2 framework on windows 2000 when using System.DirectoryServices . {System.Runtime.InteropServices.COMException} System.Runtime.InteropServices.COMException: {"Library not registered."} _className: Nothing _COMPlusExceptionCode: -532459699 _data: Nothing _dynamicMethods: Nothing _exceptionMethod: Nothing _exceptionMethodString: Nothing _helpURL: Nothing _HResult: -2147319779 _innerException:

ASP.NET Page Cycle Confusion

时光毁灭记忆、已成空白 提交于 2019-12-24 10:59:19
问题 If I have a button on my ASP.NET page which will take you to another page but that page will do something and then will send user back using Uri uu= Request.UrlReferrer; if (uu!= null) Response.Redirect(uu.ToString()); Now Which page event can I use so that when other pages displays I can display a message box. In short I am running my custom code in a "aspx" page where user is directed on button click, and then after custom code I am sending user back to old page, but it happens so quickly

With NAnt, How to use C# 3.0 compiler while targetting .NET 2.0 runtime?

放肆的年华 提交于 2019-12-24 10:38:55
问题 I'm using NAnt 0.85 to build a legacy project. The script itself uses the csc task (not the msbuild task) and works fine. The project is on its way to migrating over .NET 3.5. We already use VS2008, and C# 3.0, while still targeting .NET 2.0 framework runtime. Now the problem occurs when we want to upgrade our NAnt scripts, to compile C#3.0 code using csc task. I managed to compile C#3.0 code with NAnt, by modifying the nant.exe.config to add the net-3.5 framework section, but still, I can't

What is the best approach upgrading from .NET 2 to 3.5?

久未见 提交于 2019-12-24 10:32:41
问题 We've been developing apps since .NET 2 release and now we are planning to upgrade to .NET 3.5. What is the best approach upgrading from .NET 2.0 to 3.5? BTW ... the external components that we use are: 1. EntitySpace - ORM 2. Microsoft Enterprise Library 3. Microsoft ReportingViewer 9.00 4. Telerik ASP.NET Controls 回答1: .NET Framework 3.5 is a superset of .NET Framework 2.0. You shouldn't have to do anything except re-target your build output. If any third party components require .NET 2.0

Highlighting a particular item in a combo box

孤街醉人 提交于 2019-12-24 03:39:10
问题 I have a scenario where I am populating a combo box with the template names. Amongst the templates one would be a default template. I want to highlight the default template name when I populate the combo box (so that the user knows which one among the items is the default). Is it possible to do so? If yes how? I am using a Windows Form in C# 2.0. 回答1: It depends a bit on how you want to hightlight the item. If you want to render the text of the default item in bold, you can achieve that like

Top-Left box alignment on a multi-line CheckBox with a large font

耗尽温柔 提交于 2019-12-24 02:14:46
问题 Working on a WinForms .Net 2.0 project, I need a checkbox to support multiple lines such that the box itself will be aligned to the top-left corner. This is done using CheckAlign = System.Drawing.ContentAlignment.TopLeft , which different from the default ( MiddleLeft ). When working with the default font this looks OK, but when the font becomes larger - what happens is that the gap above the text increases, yet the gap above the box itself remains constant. The result is that the box appears

How to embed an image into another image using C#?

梦想与她 提交于 2019-12-24 00:52:15
问题 In my project user will upload an image and the logo of project will be attached(Embeded) to the bottom of the image. Is it possible to implement? If yes then how to implement that? Please help. 回答1: Some people call this watermarking, I would search around for that. Have a look at http://www.codeproject.com/KB/GDI-plus/watermark.aspx 回答2: Yes it is possible to implement. Look at the System.Drawing namespace. You can use the Bitmap class - it will allow you to load images from files. Create

How to sort array of FileInfo objects in descending order without LINQ

好久不见. 提交于 2019-12-24 00:19:28
问题 I have to downgrade my code to be able to work on NET 2.0, which does not support LINQ. Currently, the code sorts an array of FileInfo objects by their FullName property, using LINQ, like this: Dim files As FileInfo() = ' ... files = files.OrderByDescending(Function(x) x.FullName).ToArray() How can I perform the same kind of sort in the 2.0 .NET Framework without using the OrderByDescending LINQ extension method? 回答1: To sort an array without LINQ, you can use the Array.Sort shared method. If

Using XPath in C# for get all the node values from XML

梦想与她 提交于 2019-12-23 23:14:01
问题 I have got XML below: <tcm:Component ID="tcm:481-636667" IsEditable="false" xmlns:tcm="http://www.tridion.com/ContentManager/5.0" xmlns:xlink="http://www.w3.org/1999/xlink"> <tcm:Context> <tcm:Publication xlink:type="simple" xlink:title="07 Internal Test Publication" xlink:href="tcm:0-481-1"/> <tcm:OrganizationalItem xlink:type="simple" xlink:title="System Resources" xlink:href="tcm:481-92640-2"/> </tcm:Context> <tcm:Data> <tcm:Title>IBE - Skywards</tcm:Title> <tcm:Type>Normal</tcm:Type> <tcm

Constrain type to specific types

限于喜欢 提交于 2019-12-23 17:54:34
问题 Is it possible to constrain a generic method on specific types? I want to write something like this: public T GetValue<T>(string _attributeValue) where T : float, string { return default(T); // do some other stuff in reality } I'm mostly just trying to avoid having a giant switch statement inside the method or having to throw an exception if an invalid type is specified. Edit: Ack. I knew string is not a value type. I started out with two numeric types earlier. Sorry. 回答1: You can't use