.net

How do I get MessageBox button caption?

Hello, I'm making a custom message box that lets you copy text, but I wanted it to look exactly like a standard message box, so I would like to set the buttons text to whatever the system language is, as the MessageBox class does. Does anyone knows how to get that text ("Yes", "No", "Cancel", etc)?. ...

Generating a Word Document with C#

Given a list of mailing addresses, I need to open an existing Word document, which is formatted for printing labels, and then insert each address into a different cell of the table. The current solution opens the Word application and moves the cursor to insert the text. However, after reading about the security issues and problems associ...

Using .net RichTextEdit, but filtering data types?

The RichTextEdit control in .net does 99% of what I need to do for my application, except for a few little things: 1) I want to disallow pasting/dragging images into the control 2) When text is pasted/dragged into the control, I want to reset its style to the control's default As far as I can work out, Microsoft hasn't provided any type...

What is the simplest unique identifier available in .Net?

So I have this public class Foo { public int UniqueIdentifier; public Foo() { UniqueIdentifier = ???? } } How do I get a completely unique number? Thanks! ...

Type variance in .NET Framework 4.0

IEnumerable<T>, IComparable<T> and a few more are now type-variant. IList<T>, ICollection<T> and many others aren't. Why? ...

WCF:: ServiceHost: Oddity...Still alive even if thread is dead?

Hello, a new member here. Nice to see such a neat community. After a bit of research, I decided to use WCF in my application to do inter process communication, so I am using the NetNamedPipeBinding binding. The ServiceHost hosting application is not a dedicated server, so it has to spawn the ServiceHost via a thread. So far so good. S...

WCF Return command for application to run.

In the kiosk system I'm setting up, all Kiosks communicate with a central server to check in and receive update commands. I don't use the Dual Http communication because I can't guarantee what ports are going to be allowed at the client site, so communication is always initiated from the Kiosk (client). I currently have an Update contrac...

Can anyone recommend a .Net open source alternative to Windows Workflow?

What alternatives are there to Windows Workflow in the .Net stack? And if you have used these solutions, what made you select them over Windows Workflow and was it a good choice. Update: I went ahead and selected stateless created by Nicholas Blumhardt. This is a very simple approach to modeling states in a domain. Below is sample...

Is there a clean way of referencing generic classes in a non-generic context?

Consider the following: public interface ICleanCoder { void DoSomeCoding(object task); } public interface ICleanCoder<T> { void DoSomeCoding(T task); } ... public class TestCleanCoding { void RegisterCleanCoder(ICleanCoder coder); } I have to have the initial non generic interface to enable a non generic reference to it...

What's a good lightweight programming language that compiles to native windows code?

I'm a .Net developer but I have a situation where I can't guarantee that the .Net Framework will be installed on the target machine. I've seen a few questions (here and here) that suggest using NGen to compile to native code. Both point out that you still need the framework though. I want to write a fairly lightweight app (basic GUI, ...

datetime picker in C#

I am developing C# application and would like to allow user to enter the time as well as date in datetimepicker.Please let me know how to acheive this ...

XmlSerializer and controlling namespace in XmlAnyElement

using dotnet 2.0. Code to illustrate : Class1 c1 = new Class1(); c1.SomeInt = 5; XmlDocument doc = new XmlDocument(); doc.LoadXml("<anode xmlns=\"xyz\" ><id>123</id></anode>"); c1.Any = new XmlElement[1]; c1.Any[0] = (XmlElement)doc.DocumentElement; XmlSerializer ser = new XmlSerializer(typeof(Class1)); XmlSerializ...

NHibernate SchemaUpdate

From personal experience, as well as everything I've read, NHibernate's SchemaUpdate doesn't support removing columns and tables. I'd like to use SchemaUpdate to generate migration DDL, but not having the deletes is making it more difficult. How do you get around this? Are there other tools that would help to keep the focus on the dom...

Can .NET code compiled with the unsafe tag run in Mono?

I have some code that does Bitmap manipulation using the LockBits method and accessing the bitmap data directly using a pointer. This code has to be wrapped in an unsafe block, of course, and I was wondering if this means that the code would not work in Mono. I'm assuming the Bitmap class is available in Mono, but maybe that's another ...

WPF SQL Distributed Data Model with LINQ and SQL Express

I am developing an application in C#/WPF that requires a distributed data model, as it will have both online and offline access. My current thoughts are to develop the first version of the application against SQL Server express and LINQ to SQL. Then use the schema to create a SQL Express Compact DB (and modify the connection string) for...

Can't use ProcessWindowStyle.Minimized to start Firefox instance minimized?

I'm having trouble using Process.Start with Firefox. I want to start a new instance of Firefox in a minimized window. The following works fine with Internet Explorer, notepad, etc.: ProcessStartInfo p = new ProcessStartInfo(); p.FileName = "iexplore.exe"; p.Arguments = "http://www.google.com"; p.WindowStyle = ProcessWindowStyle.Minimize...

How do I connect to a Telnet Server in c#?

I am having my OJT and my current task is to do an FTP Client Server connecting to a telnet Server. This is my first time doing this kind of a program. Any idea how I can do this in c# windows app? how do i establish a connection to telnet with completeauthentications? Are their any open source libraries to help me do this? Any help with...

WCF:: ServiceHost & AddServiceEndpoint: Are Arguments types reversed?

While I am trying to learn WCF, and it seems straight-forward enough, I came through an odd situation...at least it seems odd to me. Why is it that the ServiceHost ctor takes a concrete class, and the AddServiceEndpoint takes the Interface, and not vice versa? it seems the latter is more logical from an OOP standpoint. Consider the fol...

Pushing Data to unknown webservices in .NET

Hey guys, here's my requirement: I have one central App which receives requests from other apps, does something, and then returns data to that App. In its simplest form this data would be an XML document. Now, at design time, this central App doesn't know which other applications will be making requests. Each time the Central App rece...

.NET XML Serialization without <?xml> root node

Hi, I'm trying to generate XML like this: <?xml version="1.0"?> <!DOCTYPE APIRequest SYSTEM "https://url"&gt; <APIRequest> <Head> <Key>123</Key> </Head> <ObjectClass> <Field>Value</Field </ObjectClass> </APIRequest> I have a class (ObjectClass) decorated with XMLSerialization attributes like this: [XmlRoot("ObjectC...