.net

visual studio 2008 extended c# intellisense

Hi, If I have an xml file like this: <?xml version="1.0" ?> <CATALOG> <TITLE>Title1/TITLE> <COUNTRY>USA</COUNTRY> </CaTALOG> </xml> can I call Catalog tag like a class name from intellisense when I edit c# application ? and his child Title1 and USA ? Example with intellisense VS 2008 c# : 1) System.DateTime.Now; 2...

Render webbrowser control offscreen (or hidden)

I have a small application which embeds webbrowser controls. In that application I have created a popup class. This popup is used to display server generated error messages. I want to be able to resize the popup to suit the message. This is so a short message is not contained in an oversize form and a large message is not in an undersiz...

System.Windows.Media.Imaging for asp.net

There are some very useful classes for working with images. I am stuck with gdi+ for now, I would like to use these classes for my web app. I tried to add a reference but I can't find the assembly. Any ideas if this is even possible? http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.aspx ...

detect picture orientation with ImageMagick

I want to resize a picture to a new size using one parameter: Width. If the picture is horizontal, the new size will be: width = Width, height = proportional to width. And if the picture is vertical, the new size will be: height = Width, width = proportional to height. Any idea how to implement this? I'm using ImageMagick with Magick...

How to invoke methods with ref/out params using reflection

Imagine I have the following class: class Cow { public static bool TryParse(string s, out Cow cow) { ... } } Is it possible to call TryParse via reflection? I know the basics: var type = typeof(Cow); var tryParse = type.GetMethod("TryParse"); var toParse = "..."; var result = (bool)tryParse.Invoke(null, /* what are ...

Remove ajax scripts from html output ASP.net

I am talking about the WebResource and ScriptResouce js files that are added to the page html. They are quite big. On some pages I don't need them, so it is safe to remove them. It would seem logical just to remove the scriptmanager, however this is not an option. Some pages use ajax based on a query string. and i use an update panel to...

Design question in WPF .NET.

Event Management An event is an entity which can be triggered when specified condition is met. User creates an event giving following inputs: Event Name Event Type ( event can be categorized ) Based on event type there is a condition which user has to specify. This condition is a criterion for raising the event. Event has Notification...

why non-static fields cannot be initialized inside structs

Consider this code block: struct Animal { public string name = ""; // Error public static int weight = 20; // OK // initialize the non-static field here public void FuncToInitializeName() { name = ""; // Now correct } } Why can we initialize a static field inside...

.Net: What does it mean? Having a non-static class with a static method?

What does it mean? Having a non-static class which has for example one static method? Without creating an instance of that class, we can't use it. But What about its static method? ...

Suggestions regarding the .NET tool to use for project

Hi, I need to develop a project that needs to have a Ticker and an AdRotator, apart from some button controls and a banner. I have two options - ASP.NET and Windows Forms. With Windows Forms, I've been able to develop the Ticker, but I don't know how to develop the AdRotator. With ASP.NET, I'll have to develop Ticker using AJAX, where...

calling command line from .NET application

I want to call from a c# application a command line starting from it an application and retrieve the stat from it. I did this but something is missing: ProcessStartInfo psf = new ProcessStartInfo("cmd.exe", "/C time"); psf.WindowStyle = ProcessWindowStyle.Hidden; psf.RedirectStandardOutput = true; psf.UseShellExecute = false; psf.Creat...

Which CLR will an application that uses DLLs that have been compiled for different versions of .net use?

This is pretty obvious I think but I thought it better to ask: If an application (exe) is compiled to run on .net 3.5 and if the dlls it uses are compiled for .net 1.1 will the DLL automatically use the 2.0 CLR, i.e the parents? What about vice versa? If so, what about compatibility issues? ...

How to build a project with a different character encoding?

I have source code with an encoding different then my system's default encoding for non-Unicode application. For example my machine is default to Windows 1255, but the code I am trying to build is in Windows 1252 encoding. Is there a way to set the MSbuild encoding to a specific encoding for a specific build? This is a machine that do...

Why only some child elements will have their properties defined by their parents

<Window x:Class="tests.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" Background="Red" Foreground="Cyan"> <StackPanel VerticalAlignment="Center"> <Button>123</Button> ...

How can I reduce the amount of configuration needed in .config for Unity dependency injection?

I've got dependency injection working with Unity and it runs nicely but I want to reduce the amount of cruft in the app.config as it is getting huge. This is an issue because the customer routinely 'cleans up' the config by removing comments etc and we end up with a few hundred lines of nasty XML without explanation. So, is there a way...

How to reuse a piece of XAML in a ContextMenu?

Say that I have the following piece of XAML: <Window> <StackPanel Orientation="Horizontal"> <Label>Phone:</Label> <TextBlock Text={Binding PhoneNumber}"/> </StackPanel> </Window> I would like to reuse this as the content of a ContextMenu. What is the best way to do that? ...

How can I make notification popups on Windows Mobile like this?

These notification popups have a title, a description, and a custom menubar. They open up front-most touched to the menubar. I want all this stuff created for my app. How can I make notification popups on Windows Mobile like this? I am on CF 2.0 and C#. UPDATE1 The linked reference to the use of Notification class does not provide ...

Dllhell with .NET

Hi, guys. Rather than trying to piece out the individual pains I'm dealing with, I want to give the 10 000 feet overview of it. I learn .NET as I go, and I suspect that there is something obvious that I'm missing here. I'm sitting working overtime on a Sunday and I'd really appreciate if someone would toss in their five cents. Here g...

Creating Active Directory user with password in C#

Hi all, I'm looking for a way to create Active Directory users and set their password, preferably without giving my application/service Domain Admin privileges. I've tried the following: DirectoryEntry newUser = _directoryEntry.Children.Add("CN=" + fullname, USER); newUser.Properties["samAccountName"].Value = username; newUser.Propert...

How to get a datagrid cell values.

Using VB.Net I want to get a all datagrid cell values, then insert into table1. Code cmd = New SqlCommand("insert into table1 values('" & DataGrid.Rows(0).Cells(0).Value & "', '" & DataGrid.Rows(0).Cells(1).Value & "', '" & DataGrid.Rows(0).Cells(2).Value & "', '" & DataGrid.Rows(0).Cells(3).Value & "')", con) cmd.ExecuteNonQuery() ...