.net

factory class that prevents direct instantiation

How to create a factory class that prevents direct instantiation of a class ? say, i have class Comment that should only be instantiated from a class CommentFactory. I don't want Comment to be able to be instantiated directly. I figured I could do this : public partial class Comment { private Comment(){} public Comment Cre...

.NET equivalent of Java's TreeSet operations tailSet and headSet?

Hello, I'm trying to use .NET 4's SortedSet<T> collection. It seems to have everything I need minus a couple things. Q: I want to be able to fetch all elements lower or higher in comparison to a given value. In Java's TreeSet, there are methods named tailSet and headSet, which perform these operations. I'd like to be able to do the...

Users IP Address when many NIC

I am wanting to get the users IP address (the logged in user will be running the application under there user context on there local PC), but many PC's in our environment have multiple NIC's that have been added by VMWare Workstation, I would like to exclude these type of bridged connections and only show the "primary" NIC on the PC. Th...

reading outlook pst files without outlook

is it possible? i don't want to use COM outlook dll , is any free .net librarys? ...

Insert Data into mulitple table using FK's using Entity framework

Hi I have tables Movie - ID, Name, Description, DirectorID-Fk, MusicID-Fk Director - ID, Name Music - ID, MusicName Now I am trying to insert a new record to movie but I dont know whether Director is already existing in the DB and same with the Music). From UI i am taking all movie information, DirectorName and MusicName. Now wh...

Late binding of COM->NET call with enum value argument(s)

First, note that this is just a learning exercise for me. The intent is to produce a .NET messagebox using nothing but pure C++ (not C++/CLI) and late binding as necessary. This works fine with just a title and text in the messagebox. However, when I try to specify buttons I get back 2147942487 "The parameter is incorrect". On the .NET...

Downcasting a generic type in C# 3.5

Why can I only upcast a generic and not downcast it? How is it not clear to the compiler that if my constraint says where T : BaseClass and U is derived from BaseClass that (U)objectOfTypeT is valid? ...

Do i handle well database connections (Entity Framework)?

I think i am doing something wrong in here so i will paste here so you can put me to the right track: public MembershipCreateStatus CreateUser(string username, string password, string mail, bool autoemail, string fullname) { using (TemplateEntities ctx = new TemplateEntities()) { ...

The order of elements in Dictionary

Hi, My question is about enumerating Dictionary elements // Dictionary definition private Dictionary<string, string> _Dictionary = new Dictionary<string, string>(); // add values using add _Dictionary.Add("orange", "1"); _Dictionary.Add("apple", "4"); _Dictionary.Add("cucumber", "6"); // add values using [] _Dictionary["banana"] = ...

Host a .NET web service

Are there any companies out there that host .NET web services for a monthly fee? Can you please recommend some of the good ones that are simple to deploy and cheap. ...

Which IPC to use?

Background I got a client/server solution which is using a mix of services (like IUserService to add/remove/fetch etc) and messages (like UserCreated, CallArrived etc). Each client authenticates when connecting. It's a software as service solution and therefore all messages may not be transported to all connected clients. Therefore I ne...

Select folder dialog WPF

Hi, I develop WPF4 application and in my app I need to let user to select a folder where aplication will store something (files, generated reports etc.). My requirements: — Ability to see standard folder tree — Ability to select folder — WPF look & feel, thid dialog must looks like part of modern application designed for Windows Vis...

Library for producing consumer-playable DVDs

So I have an application that creates VOBs as a step for DVD creation. I am using StandardMPEG encoder, and it works like a charm. Burning actual .ISO isn't my concern here, but building it is. I need a library that is able to create simple menu, mark some chapters for the VOB, and finally create an ISO that should be burned. I would b...

Problem with Protobuf

I switched to work on another computer, I installed visual C# express and protoBuf-net, and then I copied the source of the project to the other computer. Now when I open the project on the second computer, the program does not serialize and deserialize the data. When I'm debugging, every time I step into a piece of code using Protobuf,...

arabic text box

hi every one. i develop a web site some fields entered in English and others entered in Arabic language,, now i wanna to simplify the input operation for the user ,i wanna arabic textbox as a DLL ,, i have one but it works only with IE not with firefox or google chrome .. thanks so much ...

multiple webbrowser navigation freeze problem

Hi, I have problem with multiple webbrowsers on form so i created simple form with 10 browsers in it and 1 button: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click WebBrowser1.Navigate("http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/8a234c57-0872-469d-9b34-c89...

How do I change the size of a group in the Ribbon Designer?

I'm designing a ribbon in Visual Studio 2010 and I have reached a problem, that I really don't get. As the title says, how do I change the size of a group? There are no visual way to change the default size and it seems to auto-size when being used instead. My main problem is that I want to position the button labeled "test" to the rig...

Custom slider with an image or path.

Hi, I have a slider in my WP7 app that I would like to restyle. Im having a problem with default template I made something like this but I cannot "bind" the thumb to the value. <Style x:Key="ThumbStyle1" TargetType="Thumb"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType...

C# - Get namespace function belongs to?

Something alike, if I input the string "Console.WriteLine", it would return -> "System.Console.WriteLine" I assume there's some way via Reflection. ...

Removing older values from a List

I have a list that I want to be able to store 20 values. What would be a good approach to deleting older values. A better example would be, imagine a change history and I wan't to be able to store 20 latest changes, while older ones go away. Is there a special thing in C# that will let me do that or do I have to either make my own or us...