.net

.NET UserControl's MouseLeave strange behavior

I have a userControl (.NET 1.1 Winforms) that has a clickable picturebox as a button. Since I have lots of those usercontrols visible at the same time, I thought It could be nice if I just display the picture box when the mouse is over the usercontrol and hide it otherwise. To do so, I handle the MouseEnter and MouseLeave events of th...

Type Constraint on foreach using LINQ extensions.

I have seen a method somewhere here on SO to restrict items returned from a foreach loop to a certain type, using, if I remember correctly, LINQ extensions on IEnumerable and a lamda for the type check. I can't find it again, can anyone suggest how this was achieved? ...

Build a program from A->Z

I have read a lot of books about Microsoft Dot Net and I have learned a lot of things Object Oriented programming Windows User Interface designing Using SQL Server and XML Debugging an application Using Serialization and application Domains Deploying a Windows application Security and licencing I know how to do all that, no perfect a...

How to define a Structuremap named instance in Code

Hi, I want to create a Structuremap named instance in code, without config file I want to be able to create the instance like this: var namedInjector = ObjectFactory.GetNamedInstance<IInjectable>("Other"); I cant define such a type in code. I have found this sample but it uses the old syntax of a previous version and defines the nam...

Which control performs the type conversion:GridView or data source control?

Hello, Say we data bind GridView to an ObjectDataSource control and then perform a query. A) I realize displayed GridView fields are of type String, but does GridView also know of what type the underlying data source values are ( for particular GridView column )? * Thus, if data source will populate GridView with bunch of integers, th...

OutputCache behaving strangely

hello, <%@ OutputCache Duration="3600" VaryByParam="none" %> protected void Page_Load(object sender, EventArgs e) {Label1.Text = DateTime.Now.ToString();} If, after I compiled this newly created application, browser B1 is first to request Cache.aspx, then the time displayed on received page is 10.16:20. If, after say 10 seconds,...

SubSonic Dynamic Schema: SelectList

Scenario I am using SubSonic for my latest project. First things first; this project is constrained to using .net 3.0 and SubSonic has been GREAT. I love it. However, I'm having some trouble with customization. The customer has requested that we use two SQL Server 2005 databases, one of which will replicate the other, minus some col...

What is the point of a Policy Server? (Silverlight)

I've been messing around with Silverlight sockets and after scratching my head a bit as to why my connections were being denied I realized I needed to set up a policy server. Silverlight connects to the policy server port on the host specified by the socket connection. The policy server returns an XML file designating what access is allo...

Deprecate other methods/types

To prevent using some members (or type) there is a way to mark them as obsolete (and sometimes in the future remove them completly). But is there a way to deprecate members (or types) of the compiled third-party assemblies? Or, at least, to make sure (or to issue a warning) when they are used? ...

.NET --- Textbox control - wait till user is done typing

Greetings all, Is there a built in way to know when a user is done typing into a textbox? (Before hitting tab, Or moving the mouse) I have a database query that occurs on the textchanged event and everything works perfectly. However, I noticed that there is a bit of lag of course because if a user is quickly typing into the textbox th...

.NET Choosing between Structures and Classes

Duplicate: When should I use a structure instead of a class? Just wondering if anyone can provide some advice or examples of when it is best to use a structure over a class in .NET or vice versa I have done some background reading and understand the differences between two, ie structures are stored on the stack, classes on the heap ect...

Is there a reason I should not start with C#

I think I'm leaning toward C# and .net as a concentration language for learning web development. I would like to learn good programming fundamentals and I've looked at pretty much everything else. The four I've narrowed it down to have been C#, Python, Ruby and PHP. Is there a reason to stay away from C# (and I don't think the cost iss...

Is there a way I can tell a process before it starts up or after it starts up which IP address to use on Windows?

I can program in C# so if there are any .NET classes available to reassigning IP addresses or if there is a command line operation for changing the IP address of a given process, that is what I think I'm looking for. I'm doing some automated browser testing and I want to have requests coming to my site from different IP addresses. My we...

.Net ORM that works well with MySQL

My C# Windows Service ( It's a service, not a MVC web application!) needs to talk to MYSQL database. In order to ease my data layer effort I am thinking about using an ORM for this purpose. So which .Net ORM works most well with MYSQL database? NHibernate? Subsonic? Entity Framework (haha)? LINQ2SQL( no, this can't be the choice, can it...

Does ASP.NET's BlogEngine.Net Stack Up to Wordpress?

I'm somewhat familiar with Wordpress and I've used it a little. There is a huge community with tons of plugins and themes etc. Does the BlogEngine.Net compare favorably? Is there another .NET CMS that you would recommend? Thanks for your help. ...

App.config - encrypted section error:

I have an application that encrypts a section in the configuration file. In the first time that I try to read the encrypted section from the config file I get an error message: "Unrecognized attribute 'configProtectionProvider'. Note that attribute names are case-sensitive. " config = ConfigurationManager.OpenExeConfiguration(Confi...

Anyone have experience with slide.show2?

I'm looking to use Slide.Show2 on a website, however I have run into a few problems, and I am wondering if they are worth fighting through or not? Problems Thus Far: XmlDataProvider does not support query string parameters in the Path argument. While I've managed to hack around it, this raises some serious warning flags to me about t...

AssemblyInfo versioning ignored in ASP.NET MVC Web App?

Strange one here. My MVC Web Application's version number is not printing correctly to my view according to what is set in AssemblyInfo.cs. The definition I have set in set AssemblyInfo.cs is '1.0.232.0'. I have tried multiple methods in order to print it: <%= System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToStri...

Is there an easy way to use InternalsVisibleToAttribute?

I have a C# project and a test project with unit tests for the main project. I want to have testable internal methods and I want to test them without a magical Accessor object that you can have with Visual Studio test projects. I want to use InternalsVisibleToAttribute but every time I've done it I've had to go back and look up how to do...

How to get a tree structured table data by linq?

I have a table which has a tree structure in itself. Id ParentId Name ---------------- 1 null x 2 null y 3 null z 4 null t 5 1 xx 6 1 xy 7 1 xz 8 2 yx 9 2 yy 10 9 yyx 11 10 yyxx 12 11 yyxxx I want to retrieve the whole sub-tree under a root node. When my r...