.net

Add a function in my .NET application as an event handler in another .NET application

We have a .net application that we didn't develop, but use. I can tell using reflector that this application has 1) a static variable in the form main form that is a reference to that "main" form and 2) has an event that is fired that I want to be able to take action based upon. I know what I'd do if it was in my application (mainForm....

How to access the databound selected item in a datalist after postback?

How do you access the databound item after postback? I have a datalist,and when the user selects an item, the OnItemCommand event fires, and my event handler looks liek this: protected void dlResults_Select(object sender, DataListCommandEventArgs e) { MyItem item = e.Item.DataItem as MyItem; } item is always null. Is there a way t...

CLR - Common language runtime detected an invalid program in VS.NET

I have been using Visual Studio 2008 quite long but lately I am getting this message when I am developing an application in C#: Common language runtime detected an invalid program This happens when I try to enter to the properties of a component (text masked box properties, tool box property etc..). But it really became a problem w...

Dynamic filtering with an ItemsControl combobox

Hi, I have this situation where I want to display a list of Administration objects and a ComboBox for each Administration. Inside this ComboBox I want a list with Employees belonging to this Administration, along with an empty option. So I need to filter based on Administration. So far I've come up with the following code (note: object...

TemplatePagerField OnPagerCommand event stops firing

Ok, so I've got a page with a listview and three datapagers. However, the issue I'm having is with just one of the datapagers, I mention the others just in case they can interfere somehow (new to this listview/datapager business). This is the datapager giving me trouble: <asp:DataPager Visible="false" ID="alphabetPager1" PagedControlI...

Uninstall .NET Framework 3.0 SP1 in command line

Hi, I have been trying to uninstall .NET Framework 3.0 SP1 using command line with the dotnetfx30sp1.exe. I have tried the /remove and /uninstall switches but all that happens is it says that it is already installed. Is there anyone that used the command line uninstall command? I'm trying to do a silent uninstall but just trying to u...

What are the true benefits of ExpandoObject?

The ExpandoObject class being added to .NET 4 allows you to arbitrarily set properties onto an object at runtime. Are there any advantages to this over using a Dictionary<string,object>, or really even a Hashtable? As far as I can tell, this is nothing but a hash table that you can access with slightly more succinct syntax. For exampl...

DownloadDataAsync + Delegate C# works in main but not in class function

I ran this persons code. It worked as a main but when i put it in my class it doesnt work. Why? http://stackoverflow.com/questions/1585985/how-to-use-the-webclient-downloaddataasync-method-in-this-context/1586014#1586014 It crashes bc data == null and throws an null exception :(. public class Test2 { public void func() ...

How to fetch object name using reflection in .net?

In .net how do I fetch object's name in the declaring type. For example... public static void Main() { Information dataInformation = new Information(); } public class Inforamtion { //Constructor public Inforamtion() { //Can I fetch name of object i.e. "dataInformation" declared in Main function //I want to set the object's Name prop...

Permutations of a given set of numbers

Can someone please explain a good algorithm to find all permutations of a given set of numbers in an efficient manner? ...

Why is C and C++ IDE tool support behind what's available for managed platforms?

If you have used any decent java or .net IDE you can see the abundance of features that they provide that either do not exist in c/c++ IDEs or exist in a much more limited form. I am thinking about features like: Code Completion Syntax Errors (and compilation errors with no need to compile) Refactoring Debugging (the amount of informa...

Code Contracts and type conversion

Hello. I've tried to embrace Microsoft DevLabs Code Contracts static analyzer and faced situation when I do not actually know is it me or is it them. So here is the code: public static int GenerateInBetween(int min, int max) { Contract.Requires(min < max); Contract.Requires((long)(max - min) <= (long)(Int32.MaxVa...

Visual Studio 2008 Debugger is not reporting some common errors

I'm currently using VS2008 and VB.NET. When I attempt to populate a Queue that has not been instantiated with objects, the program simply hangs without throwing an error. I have run into this issue multiple times in different parts of the program in the past few days. What could be the cause of this? Here's the code: Structure Conso...

How can I open Excel just after creating it programmatically in .NET?

Hi to All, Hi I am creating the application which creates the excel file pro grammatically. Now I want to open it just after saving it pro grammatically in my code. How I can open the file. Please reply... Regards, Girish ...

What are the XSLT processor for .NET?

I'd like people's opinion on the "best" XSLT processor for .NET, but what are the good options for processing XSLT in .NET? What do you use and how well does it serve you? ...

Should I learn VB.NET or C#?

Background I have decided to do my graduation project (yet to start) in .NET. Regarding it, I am bit confused about: what language should I learn: VB.NET or C#? What I have learnt from those who know it that both VB.NET and C# have: The same concepts VB.NET is simpler as it is more like English statements but also C# is simple too...

is it possible to extend class attribute in .net?

I have a library. This library contains class named tPage. This tPage class not marked serializable. I can't modify this library. I need to serialize this. How to extend this class attribute? Is it possible? ...

How to initialize my web control properties at design-time?

Hey, I need a way to initialize my web control's properties when it's dropped on the designer area. As "initialize" I mean: If my control has a property Prop1. I need to assign a value to Prop1 and I need this value to be persisted on ASPx. I tried the following: Implement InitializeNewComponent on my ControlDesigner: This method is ...

What is wrong with my implementation of: c# extension methods

Hi, the source is throwing the error: 'nn.asdf' does not contain a definition for 'extension_testmethod' and i really don't unterstand why... using System.Linq; using System.Text; using System; namespace nn { public class asdf { public void testmethod() { } } } namespace nn_extension { using...

Optimizing a high-traffic function in XNA

I have a function that's called hundreds of thousands of times per update, and i need to optimize it. Now, i generally follow the "don't optimize too soon" rule but this is a critical function that virtually all of my code's time is spent in, so anything you can suggest would help. I'm also not that familiar with any sort of tips and tri...