.net

Find as you type in C#

Im trying to emulate a 'find as you type' function like that of the address bar ("awesome bar") in FireFox. I want a suggestion box to appear below a textbox, and the suggestion box contains strings that contain what is in the textbox. I looked at the autocomplete feature of a normal WinForms textbox, but it seems to only search the be...

C# AddEventHandler using Reflection

I have this piece of code that not work public CartaoCidadao() { InitializeComponent(); object o = WebDAV.Classes.SCWatcher.LoadAssembly(); MethodInfo method = this.GetType().GetMethod("Inserted", BindingFlags.NonPublic | BindingFlags.Instance); EventInfo eventInfo = o.GetType().GetEvent("CardInserte...

upload a tweet using C#

Possible Duplicate: What is the best Twitter API wrapper/library for .NET? My boss wants to make periodic updates to the company twitter account but doesn't really want to mess with it through the web or follow others. I'm sure there is plenty of info but I thought I would start out by asking the experts is there a twitter cl...

How do I determine which monitor my .NET Windows Forms program is running on?

I have a C# Windows application that I want to ensure will show up on a second monitor if the user moves it to one. I need to save the main form's size, location and window state - which I've already handled - but I also need to know which screen it was on when the user closed the application. I'm using the Screen class to determine th...

Finding out if a type implements a generic interface

Let's say I have a type, MyType. I want to do the following: Find out if MyType implements the IList interface, for some T. If the answer to (1) is yes, find out what T is. It seems like the way to do this is GetInterface(), but that only lets you search by a specific name. Is there a way to search for "all interfaces that are of the...

Read-only properties in C# 3.0 object initialization

If I have the following code: public class MyClass { public string myName { get; private set; } public string myId { get; set; } } A private compiler-generated variable is created for the setter. I want the setter not to be accessible for object initialization only. But, how do I get to initially set the myName variable? Rea...

How to determine SQL Server stored procedure parmeters at run time in .NET?

Is there any way for an application to determine the parameters and paramter types of a stored procedure at run time? ...

How to get log4net to keep only the last X days of logs?

I only want log4net to keep let's say 10 days-worth of log files as keeping them growing indefinitely will eventually eat up my disk space. I had thought that I could do this by setting <maxSizeRollBackups value="10" /> on my RollingFileAppender but no dice. How do I do this? ...

How do I serialize a mail message?

I get the following when tying to serialize a mial message using the los foratter. Error: Sys.WebForms.PageRequestManagerServerErrorException: Error serializing value 'System.Net.Mail.MailMessage' of type 'System.Net.Mail.MailMessage.' Is there an EASY way to serialize this object or am I going have to searialize each o fhte propertie...

Using RdfProperty of array to custom class

I have defined: [RdfSerializable] public class SomeItem { // Unique identificator of the resource [ResourceUri] public string ID { get; set; } [RdfProperty( true )] public string SomeData { get; set; } } and in some other class: [RdfProperty(true)] public SomeItem[] MyTestProp { get { return new SomeItem[]...

XSLT and XML Question

I have this kinda interesting requirement. Typically you use XSLT to transform an XML document. The transformed HTML is viewable in a web browser, this works just great. I am also guessing the browser handles the transformation in memory, because if you view the page source of an xml document with XSLT, you don't see html, only xml. ...

Can I run a .NET application (or method from .NET dll) in Amazon Elastic MapReduce?

What I need is a powerful machine that will run my .NET code one hour a day. I can't use EC2 cause it will loose all my data on shutdown. I need a virtual PC that I can start at specific time, and this PC should start my .exe/service/whatever automatically. Can I ask Amazon MapReduce to start a Windows instance and execute my code? ...

How do I return a reference to an interface from a WCF contract?

I have a WCF service. I can return a concrete class without a problem, but returning a reference to an interface causes the following issue. CommunicationException occurred "The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlyin...

How do You Create a Read-Only Dependency Property?

How do you create a read-only dependancy property? What are the best-practices for doing so? Specifically, what's stumping me the most is the fact that there's no implementation of DependencyObject.GetValue() that takes a System.Windows.DependencyPropertyKey as a parameter. System.Windows.DependencyProperty.RegisterReadOnly returns...

How do I make my own Linq Clauses?

Is there a way I can create my own Linq Clauses? I have been looking into extension methods and it's not quite what I am looking for. I was thinking something like the where, the select or the from clause. I want to use my code like such var blah = from bleep in bloops where bleep == razzie myclause bleep.proper...

WPF ListView grows wider in response to resizing column, but does not shrink back.

In the following .NET 3.5 XAML, if you drag the column width of the 'Day' column wider, the ListView nicely grows to account for this. If you then drag the column width narrower, however, the table stays the same size as it was. This same problem exists vertically, too. If some of your columns have word wrap, the table will get tall...

only 1 record is being inserted

I'm running an insert statement using OLE DB and an ICommandWithParameters. In the ICommandText, I made sure to set: params.cParamSets = n ; Then cmdTxt->Execute( NULL, IID_NULL, Where n > 1, but in my database, all I see is 1 insert happening. The docs say cParamSets is greater than one) can be specified only if DBPROP_MULTIP...

Generate a unique temporary file name with a given extension using .NET

Possible Duplicate: How can I create a temp file with a specific extension with .net ? It is possible to create a temporary file in .NET by calling string fileName = System.IO.Path.GetTempFileName(); This will create a file with a .TMP extension in the temporary directory. What if you specifically want it to have a different...

.NET/C# equivalent to Java Metadata Interface (JMI)

Is there any open source project/APIs for .NET/C# equivalent to Java Metadata Interface (JMI)? http://java.sun.com/products/jmi/ ...

What is the point of the key parameter in ModelState.AddModelError in ASP.NET MVC?

I enjoy writing validation functions in my controller that modify the ModelState if the validation fails. For example: private bool ValidateMoney(string raw, string name, decimal min, decimal max) { try { var dec = Convert.ToDecimal(raw); if (dec < min) { throw new ArgumentOutOfRangeException(name + " mu...