.net-3.5

C# COM Class - DISP_E_UNKNOWNNAME

I have declared a COM visible class in C#. The code is as follows: [ComVisible(true)] public class AComVisibleClass : TheParentClass { public bool SomeFunc(string id) { return true; } } This class is instantiated by a factory class, also COM accessible. But if I try to access in a VB script file, a DISP_E_UNKNOWN...

Does the telerik RadGridView have an "IsDirty" Property

Is there any way to tell whether an ItemSource (e.g. a strongly typed List) for a RadGridView has been modified in anyway by RadGridView edit or delete operations? ...

MEF error, was circular dependency and is now something else...

I've got a circular dependency that recently came about because of a change in my application architecture. The application relies on a plugin manager that loads plugins via MEF. Everything up until worked fine, because it looked something like this: // model.cs [Export("Model")] public class Model { public PluginManager PM { get; s...

Server.TransferRequest is not preserving HttpContext.Items

I've just updated my ASP.Net code from HttpContext.RewritePath(targetPath) to use the .Net 3.5 function: HttpContext.Server.TransferRequest(targetPath,true) However, I now no longer have any of the custom HttpContext.Items that I added, before the transfer. Anyone have any ideas as to how I overcome this? ...

LINQ - selecting second item in IEnumerable

I have string[] pkgratio= "1:2:6".Split(':'); var items = pkgratio.OrderByDescending(x => x); I want to select the middle value and have come up with this. Is this a correct way to select the second value in an IEnumberable? pkgratio.Skip(1).Take(1).First(); ...

IE Automation - Calling a client JavaScript **method** from server-side C#

Given the following C# code: public object CallJavaScriptFunction(string functionName, params object[] args) { object script = Document.Script; var result = script.GetType().InvokeMember(functionName, BindingFlags.InvokeMethod, null, script, args); return result; } And the following client-side Jav...

How to Implement Exchange like availability monitoring of internal SQL Server

We have an internal app(Thick Client) that relies on our central SQL server. The app is a Desktop app that allows the users to work in "Offline" mode (e.g. Outlook). What I need to accomplish is a way to accurately tell if SQL is available or not. What I have so far: I currently use the following method --> internal static void Che...

Simplest way to perform grouping/projection using Linq To Objects

I'm getting data from the data layer that I need to transform in the middle tier using Linq To Objects (I don't control that tier of the application). I have to perform a grouping operation using multiple keys followed by a string concatenation on the non key-fields. Given the data below, I want to group by CustomerID and Date, and cre...

Automating IP address assignments with .Net (C#)?

I need to automate IP Address assignments using .Net. Is there something already out there or can someone point me in the right direction. I know I can use WMI to do this, but some of the resources were for vbscript. I am hoping to use .Net Update: I need to assign multiple static IPs to a single NIC ...

Muliplying all values in IEnumerable<int>

I have the following code and I am trying to work out how to multiply all values in my IEnumerable. I thought there might by a Multiply method like there is with Sum. I guess I could do a foreach over each item but these days this seems tedious. Any suggestions? //1:2:6 string[] pkgratio = comboBox1.SelectedRow.Cells["PkgRatio"].Valu...

Is it possible to read Page MetaKeywords in .NET 3.5?

I need to read the page keywords, is it possible to do with C# 3.5 ? ...

Extension method in a where clause

I've created a simple extension method on the string type: public static bool Contains(this string word, string[] values) { foreach(string s in values) { if(!word.Contains(s)) return false; } return true; } now, I've got a linq query that looks like this: public static IEnumerable<ISearchable> Sea...

Disable validation controls based on a condition

I have an asp.net application that uses validation controls on textboxes. However, if the user enters a value in txtFieldA, then I want to disable the validation controls on txtFieldB and txtFieldC. ...

Build if then statements at run time?

My product owner has asked me to make some comparision logic configurable so the process engineers can change things without making code changes. Currently the code is a SELECT CASE statement with various IF THEN statements that are fairly standard. The problem I can't seem to find a way around is that he wants through configuration to A...

Filtering at bindingsource doesn't work

I have textbox when I put phrase of description of task or id of task. I want to filter this list by text of this textbox. But when I put text into this textbox filtering doesn't work. Collection i datagridview doesn't change. What can be wrong ? public void BindData() { var emptyBindingSource = new BindingSource...

Passing the parameter

I am passing the parameter to the function as a var type. It is not accepting, how do I pass to the function? Example var Input = ................ listview1.itemsource = getinput(Input); public List<answers>getinput(var inp) { ................ .................. } Here the function is not accepting the var. What can I do? ...

Misunderstanding databinding fundamentals and DataContexts -- long story

I've been using databinding in several simple situations with pretty good success. Usually I just use INotifyPropertyChanged to enable my codebehind to modify the GUI values on screen, rather than implement dependency properties for everything. I am playing with an LED control to learn more about databinding in user controls, and was f...

How to chain/nest XSL Transforms in .NET

Context: .NET Framework 3.5 I realize how I can perform a single XML transformation using XSLT, but didn't find any good examples on chaining XML transformations. Input: - XML document as XPathDocument. - File paths to multiple XSL files. Expected output: - preferably XPathDocument/IXPathNavigable, representing the XML with all transf...

Filesystemwatcher does not raise rename event handler in C# on Windows7

Hello, I am using C# 3.5 on Windows 7. We have implemented a program with a FileSystemWatcher. Here, rename event is not get raised. But, it is working on a few systems. What can be doable in such scenario? ...

Component object-model tutorial?

Does anyone know of a good tutorial (C# preferred) for creating a component's hierarchical object-model for .NET 3.0 or later i.e making full use of generics? work with and expose an indefinite number of contained objects; prevent client applications from directly instantiating contained objects; allow the client code to use 'tunnellin...