.net

Move a control to a floating location

I want to move a control in panel1 to the Red Line end from the following example: private void panel1_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawLine(Pens.Red, new PointF(10.7f, 20f), new PointF(50.5f, 20f)); } Is that possible in .NET 2.0? Background I draw some paths using the floating (world) coordinate...

ArrayList and Array difference

With reference to MSDN, It is stated that "You can set the lower bound of an Array, but the lower bound of an ArrayList is always zero" If i declare an array a[10], the lower bound is always a[0]. Is this the lower bound specified there? If yes, How can we set the lower bound of an array, Since the index of an array always starts with...

Serialize all properties of class to XML

I have a load of classes and I need to generate an XML schema for these classes. The easiest way I can think to do this is to create the classes, serialize as XML and then run XSD on this XML. However, if I don't set the properties of a class, no XML node is created and therefore the XSD doesn't pick it up. Is there a way for me to te...

Check for SSL when hosted in Rackspace (Mosso) Cloud

I am using Request.IsSecureConnection to check for SSL and redirecting where appropriate. When running my asp.net website on Rackspace's cloud, the server is running behind an SSL cluster, so IsSecureConnection will always return false. The same goes for checking whether the url contains "https://", always false, checking the port, etc...

AppDomain.CurrentDomain.ProcessExit and cleanup

Hi, I have simple application when I need to stop a backround thread using Stop() function before application is closed. The problem is that my Main() function has several exit points (return statements) static void Main(string[] args) { /// some code return; // some code return; //// etc } I tried to use AppDomain.CurrentDomain.Pr...

Socket problem when using threading

Can someone please explain me why the following code doesn't work? using System; using System.Collections.Generic; using System.Text; using System.Net.Sockets; using System.Net; using System.Threading; namespace SocketThreadingTest { class Program { static void Main(string[] args) { Thread t = new Th...

Silverlight 4.0 - Deploying the XAP via a custom installer and configure it for OOB + Elevated permissions

Is it possible to deploy a XAP using a custom installer (much like deploying a desktop app), and configure it to run as OOB with Elevated permissions? Bottomline is, when the app is started, it should run in Elevated permissions + OOB, with out any user intervention at all after the installation. ...

How to perform same operations on both WebControls and HtmlControls.

I find myself needing to preform the same actions on both HtmlControls and WebControls. I am a firm believer in DRY and find the fact that there is only the Control class to use if I want to consolidate the functions on both types. The problem that I have with using Control is that there certain properties that both HtmlControl and Web...

How to promote and/or sell LINQ to colleague?

How do you promote and/or sell LINQ syntax to colleague that doesn't see the benefit over the manual way of doing thing? For an example using Linq to Entity/Sql instead of using plain ado.net without any LINQ. ...

OO application layer design question

Would it be correct to assume that a controller class is the same as a service class in the application service layer. e.g. CustomerService is the same as CustomerController ...

ASP.NET Gridview styling not rendering

Why is the following asp.net code not including styling information when being rendered to HTML? <asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None"> <RowStyle BackColor="#FFFBD6" ForeColor="#333333" /> <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <P...

How can I use workflows with older versions of activity libraries in (rehosted) workflow designer ?

I used the rehosted workflow designer in an ASP.NET application to generate images of workflows, basically adopting the WorkflowMonitor sample in a similar way like the Atlas Workflow Monitor. Now I have started to worry about the behavior of this solution after redeployment when the installed version of the libraries no longer match the...

How to configure the ILoggerFactory in log4net correctly?

Background I wanted some properties to be available in the logging events for certain loggers. After doing some research on the subject I came up with the following possible solutions: Writing my own wrappers and using them instead of log4net.ILog and log4net.LogManager. Subclassing log4net.Appenders.ForwardingAppender. Implement an l...

launch powershell under .NET 4

I am updating a PowerShell script that manages some .NET assemblies. The script was written for assemblies built against .NET 2 (the same version of the framework that PowerShell runs with), but now needs to work with .NET 4 assemblies as well as .NET 2 assemblies. Since .NET 4 supports running applications built against older versions ...

Compressing result of Web Service

I have a .NET web service that returns XML, and I'd like to compress this before it is sent. There's a couple of ways that I can do this, but I'd rather not have to do it in code. Can I set up IIS to gzip all content returned by my WebService? It's not being called from a browser. The other question is if this web service is being co...

Windows.Forms, showing a disabled form in non-modal state

I have some trouble showing a disabled Form in non-modal state. Here is the example code: public partial class Form1 : Form { // .... private void button1_Click(object sender, EventArgs e) { try { Form2 form = new Form2(); form.Enabled = false; form.Show(); // works, but...

Can I declare a variable of Type<T> without specifying T at compile time?

Possible Duplicate: Can I declare a variable of Type<T> without specifying T at compile time? Objective: To Load the class "MyContent" dynamically. I have 1 interface<T>, 1 abstract generic class<T>. Code: public interface IMyObjectInterface{ } public abstract MyAbstractObject : IMyObjectInterface{ } public class MyObject : My...

Add controls dynamically to a listview

I have an asp.net listview. The data that populates it is sorted into groups, and i'm using some code in the listview item template, that essentially checks if the grouping field has changed in the data, and if so it prints a new row, with the heading, so it looks a bit like this: <ItemTemplate> <%# AddGroupingRowIfWPHasChanged() %> ...

How to handle Unhandled Exceptions in .NET COmpact Framework 3.5?

In .NET CF, is there any event like Application.DispatcherUnhandledException that allows us to capture all the un-handled exceptions to log as well as to keep the application open with out crashing? The arguments of DispatcherUnhandledException event handlers allows to stop app crashing by just setting // Prevent default unhandled exc...

CHeckboxList Updating dynamically and styling

I'm adding items dynamically when a row is selected from GridView. 1. How can i make the items added are selected by default - (solved) 2. How can i avoid duplicates getting added to list 3. How can i remove them from list when user un-checks them. And I want to change checkbox with an image and I'm using css like following but it i...