.net

How do I keep aspect ratio on scalable, scrollable content in WPF?

I'm fairly new to WPF and I've come across a problem that seems a bit tricky to solve. Basically I want a 4x4 grid thats scalable but keeps a square (or any other arbitrary) aspect ratio. This actually seems quite tricky to do, which surprises me because I would imagine its a reasonably common requirement. I start with a Grid definiti...

Specifying return rows in LINQ2DataSet

I have a requirement to extract a distinct subset of rows from a DataTable, and thought LINQ2DataSets may be a useful and clean way to do this, however it appears that it is not possible to simply identify return rows from a LINQ2DS query as follows var result = from r in fips.AsEnumerable() select r.Field<string>("FACILITY_PROCESS_SUB_...

Setting Response.ContentType="image/tiff" in asp.net 1.1 and IE7 doesn't display tif files

I have an Asp.Net 1.1 application that uses the following code to write out an image file to a pop up web page. Response.ContentType="image/tiff" 'Only for Tif files Dim objStream As Object objStream = Server.CreateObject("ADODB.Stream") objStream.open() objStream.type = 1 objStream.loadfromfile(localfile) ...

C# List<> Sort by x then y

Similar to this question, but in 2.0, we want to sort by one element, then another. we want to achieve the functional equivalent of SELECT * from Table ORDER BY x, y We have a class that contains a number of sorting functions, and we have no issues sorting by one element. For example: public class MyClass { public int x;...

Better TreeView for Windows Forms - .NET 3.5

Is there a better free TreeView control that exists for Visual Studio 2008 / .NET 3.5? I believe I need something a little more powerful than the out-of-the box version. I'm not exactly sure for what yet but I thought I'd ask quickly before I get too far in to my project... Thank you! Best Regards, Frank ...

Can you combine multiple lists with LINQ?

Say I have two lists: var list1 = new int[] {1, 2, 3}; var list2 = new string[] {"a", "b", "c"}; Is it possible to write a LINQ statement that will generate the following list: var result = new []{ new {i = 1, s = "a"}, new {i = 1, s = "b"}, new {i = 1, s = "c"}, new {i = 2, s = "a"}, new {i = 2, s = "b"}, ne...

XSDObjectGen.exe vs XSD.exe

Can anyone tell me what is the difference between XSDObjectGen.exe & XSD.exe? Is there any way to make XSDObjectGen.exe work in dot net 2.0? ...

Failed to resolve IP

Try as I might, I'm unable to resolve an address to IP. The code snippet is shown below. I keep getting the No such host is known exception, even though I could access google with my browser (The DNS server is almost certainly working). I'm however behind company's firewall. try { foreach (IPAddress address in Dns.GetHostAddresses("w...

Best object relation mapping framework to use with .net and mono?

I'm doing some research for my end of degree project: a multiplattform application developed using .net3.5 and mono2.0 I need some opinion about what you people think is the best Object Relational Mapping framework which will also run with mono. Additionaly, any opinion about what ORM will work the best for my project, will be handy (...

File System indexing

Hi, I am creating an application were I need to scan a directory hive to find a certain file. I also want to better understand how indexing works. Can anyone point me to any resource preferably in C# that shows how I can create a basic index for file system searching? Cheers Paul ...

What is best thing to call your namespace in .Net

In the past I've always gone and called my namespace for a particular project the same as the project (and principle class) e.g.: namespace KeepAlive { public partial class KeepAlive : ServiceBase {... Then from other projects whenever i've called that class its always been: KeepAlive.KeepAlive()... I'm now beginning to thi...

How to modify .NET config files during installation ?

I use the app.config file to store some values (path to a mapping database, data connection selections). These settings differ on the user machines and I would like the installer to set them right. Is there an installer that can work with .NET config files during setup and allow me to create some dialogs that would help me fill in these ...

check for duplicates in arraylist

I have an arraylist that contains items called Room. Each Room has a roomtype such as kitchen, reception etc. I want to check the arraylist to see if any rooms of that type exist before adding it to the list. Can anyone recommend a neat way of doing this without the need for multiple foreach loops? (.NET 2.0) Cheers ...

Is there a delegate available for properties in C#?

Given the following class: class TestClass { public void SetValue(int value) { Value = value; } public int Value { get; set; } } I can do TestClass tc = new TestClass(); Action<int> setAction = tc.SetValue; setAction.Invoke(12); which is all good. Is it possible to do the same thing using the property instead of the method? P...

.NET Install Package Sometimes Not Completely Removing Previous Versions

I distribute my application using a VS2008 install package, which normally works great. When I create new versions of the app, I go in and increment the Version property on the install package and verify the RemovePreviousVersions property is set to True. This works just fine most of the time - I just run the install package for the ne...

How do I get a C# WebBrowser control to show jpeg files (raw)?

Hi. Does anyone know in .Net 2.0 - .Net 3.5 how to load a jpeg into a System.Windows.Forms.WebControl as a byte-array and with the right mimetypes set so it will show? Something like: webBrowser1.DocumentStream = new MemoryStream(File.ReadAllBytes("mypic.jpg")); webBrowser1.DocumentType = "application/jpeg"; The webBrowser1.DocumentT...

Castle MonoRail Routing with IIS 7?

I’m trying to make the routing module works with default action or controller, but it doesn’t. I always face with 404 page not found. Did I forget to do something? I really like routing in ASP.NET MVC feature, but I’m not sure I could do the same in MR. I’m using IIS7 with the build from castle trunk for .NET 3.5. ...

How to check if DLL is debug-compiled

Simple Question; Is there an easy way to check whether a .NET 1.1 assembly is debug-compiled or not? ...

Best Practice: ByRef or ByVal? in .Net

What are the things to consider when choosing between ByRef and ByVal. I understand the difference between the two but I don't fully understand if ByRef saves resources or if we even need to worry about that in the .Net environment. How do you decide between the two if the functionality doesn't matter in a situation? ...

Java System.currentTimeMillis() equivalent in C#

What is the equivalent of Java's System.currentTimeMillis() in C#? ...