.net

Inspiration to get rid of MDI UI

Microsoft seems to want us to stop using the MDI, but if more people are like me they're stuck on how things used to be. Software like Word and Excel is simple to create without MDI, but I have trouble thinking out good UI without MDI. Is there a place where I, and others like me, can see examples on how to make great WinForms UI witho...

where to put the connection string in a n-tier app?

I've created a DAL using the entity framwerok. I've also created a business service layer and a presentation layer(web app). My common sence is telling me the connection string should by only in the DAL but the presentation layer needs the connection string too. So what's the best-practice for this situation ? Is there any way to have ...

.NET / WinForms - Clear a Sort on a DataGridView

What is the proper method to tell a DataGridView to stop sorting? I have a "screen" where I tell the grid programatically to sort by column 4 and ascending. When I switch to another area I want the same grid to come in 'default'/no sort. I'm removing all the columns and adding new ones. The sort remains on the 4th column. I don't see a...

Reference calling assembly instance in C#

.Net 3.5 sp1 available type question ... Is it possible to "get a handle" or reference to the actual instance of an assembly that called a method? I can get the executing and calling assembly via reflection, but what I'm after is not so much the assembly, but the INSTANCE of that assembly that called method. Simple example (maybe): ...

Make a 3D model transparent

How can I make a specific 3d model transparent? Is it as simple as changing the opacity of the model's material? I tried the following: SolidColorBrush br = (SolidColorBrush)matDif.Brush; //matDif = DiffuseMaterial br.Opacity = 0.3; When it tries setting the opacity it says that it is in a read-only state and cannot be changed? ...

Read the XML/SOAP from an XMLDocument

I assume somehow you can user an XmlReader to read the envelope from an XmlDocument. Does anyone have a good example how? I want to simply extract the entire sent SOAP text into a string variable so we can log it in case of a request error. Example methods: protected virtual HttpWebRequest CreateWebRequest(string endPoint, Int32 cont...

Why doesn't this Regular Expression match a space?

I have the following regular expression: ([0-9]+),'(.)':([0-9]+),(L|R|'.') It matches this just fine: 1,'a':1,R However, if I replace a with a space, it fails: 1,' ':1,R Why doesn't . match it? Is a space not classified as a character? I can't use \s because I don't want to match tabs and line breaks. I also tried: ([0-9]+),'(....

Visual Studio Make this the default for all deletes?

When deleting a file I accidentally checked 'make this the default for all deletes'. Now whenever I rename a file it deletes it in my source control server. How do I 'uncheck' make this the default? I already tried Tools --> import export settings --> reset all settings. ...

.net xml serializer not encoding some characters

I a class containing multiple properties of type string. One of the values contains a character of hex value 96. If I serialize the class to xml, the xml serializer does not encode that character, and if I view the xml in various tools such as IE or SQLServer with OpenXML, it complains that the character is invalid in an xml document. ...

how to get TimeZoneInfo short name

Is there any method to get the 3 char code from System.TimeZoneInfo.Local ? e.g. EDT instead of Eastern Daylight time etc. ...

Installing 'WCF HTTP Activation' on Windows Vista fails?

This is only remotely development related, but basically I wanted to install the MS Azure SDK which relies on an installed IIS 7, ASP.Net but also a working installation of the 'WCF HTTP Activation' component. Now following the article on MSDN, I always get the following error: Does anyone have an idea what I'm missing or what I shou...

VB.Net DropDown List SelectedIndex Question

In a VB.Net application, how can I either: Find the dropDownList selectedIndex position of something just added to a database. Have a form restart with the most recently-added entry showing in the DropDownList, by way of modifying the inline SQL query to display by date/time added. ...

Good WYSIWYG Math Expression Builder or WYSIWYG Plug in?

Anyone know of a good Math Expression builder for an online WYSIWIG. Ideally the user would be able to easily create common math symbols/notations like summation, integrals, radicals, etc... online, ideally in an existing editor. I also need to be able host it (and ideally integrate it) in a .NET stack (IIS/Windows). Thanks in advance!...

C#/SQL get autoincremented field value

I have a table with autoincremented primary key. In my code I am trying to receive the new autoincremented value when I execute each 'insert' query. Is there a way to do it programatically? Thanks. UPD: Assume I have a table: TABLE User ( userID INT NOT NULL AUTO_INCREMENT, name VARCHAR( 25 ) NOT NULL , email VARCHAR( 50 ) NOT NULL , U...

How deterministic Are .Net GUIDs ?

Yesterday I asked Are GUIDs generated on Windows 2003 safe to use as session IDs? and the answer combined with combined with this article GUIDs are globally unique, but substrings of GUIDs aren't prompted me to think about replacing my current mechanism of using GUIDs as session ID's in cookies. Because it's a bit of work to make that c...

Why are some .Net assemblies not available via an AppDomain's GetAssemblies() method?

I have a little bit of code that loops through the types currently loaded into an AppDomain that runs in an ASP.NET application. Here's how I get the assemblies: var assemblies = AppDomain.CurrentDomain.GetAssemblies(); When the application first starts up there is no problem and all the types I expect are present. But when I update t...

Change process name in C#?

Is it possible to change the name of a currently executing process in C# (or .NET in general)? I believe it isn't possible, but my co-worker is trying to solve a problem under the assumption that it is. ...

Convert an Expression Tree to Source Code string

I have a function that has the following signature... public string DoJunk(Expression<Func<bool>> expression) I'm trying to find a way to convert the "expression" parameter back to something resembling the original source code (or at least a c# representation of the original souce code). So, if someone calls the function like this... ...

C# Threadpooling HttpWebRequests

I've read and looked a quite a few examples for Threadpooling but I just cant seem to understand it they way I need to. What I have manage to get working is not really what I need. It just runs the function in its own thread. public static void Main() { while (true) { try { Thr...

How can I have many threads that need to know the next ID to process and then increment that number safely?

I'm working a program that will have a bunch of threads processing data. Each thread needs to grab the next available ID, increment that ID by 1 for the next thread and do this in a thread-safe way. Is this an instance where I would use a mutex? Should I use a Queue.Synchronized instead and fill it up with all 300,000 ID's or is this ...