.net

visual studio 2008 macro: write to output pane

In a Visual Studio macro, how do you write execution information on the output pane (i.e. the window that usually contains build output)? I'm using Visual Studio 2008, if that is relevant. Solution: I added the following subs to my macro project, I'm posting them here in case they could be useful. Private Sub Write(ByVal name As Strin...

How to get an ActionLink to append an / to the end of a link

Hi, My question is simple, how to get an ActionLink to append an / to the end of a link. For some reason our SEO team seem to think this is useful? (anyone? why?) currently ActionLink renders the link as More about vouchers but they would like it to be More about vouchers. Does anyone know how to easily do this without constructing my o...

WPF Dragging causes renderer to stop

I'm having a problem with my WPF app, where any sort of drag operation stops the UI from updating. The issue seems periodic, as in, the item drags, stops, drags again, stops, etc. in 2 second intervals. It's affecting all controls, including scroll bars. If checked this question as well as this one, and it doesn't seem to be caused by w...

how to use Repository pattern to make it easy switch between ORMs?

I knew than one of the benefits from using repository pattern make it easy to switch between ORM, for example will implement data access code using Linq to sql and also using Ado.net entity framework, then using Dependency injection switch which one to use. I saw KIGG doing the same "but its class diagram is complicated a little, at lea...

Not yet ported Java libraries for .NET

Hi, I often read and feel that .NET Framework has much less libraries to use in project than available in Java world. Even if some ports exists, a lot of them are not at the full speed/active. One example is Apache NFOP. It has not been updated for a while. Another is NHibernate - it is very active but does miss a lot of features that ...

Fast Lightweight .NET Client Encryption -> Server Decryption

Hi there, I have a simple client/server setup. The client and the server both have a private key. What does .NET offer me in the way of ClientData-> ClientEncrypt with KEY-> Transmit to Server-> ServerDecrypt with KEY-> ClientData Can anyone suggest any fast simple libraries to read up on? Thanks ...

Recommended build targets

I'm a solo developer looking into a tool such as MSBuild/NAnt to improve my build process. My project files are starting to get messy with post-build events and there are analysis tools I'd like to run some times and not others. I want to regain order and define everything into a build XML file. My thoughts for build targets are: Debu...

LINQ WHERE clause using if statements

Hello all, I am using c#.net I have two textboxes which if !empty need to be part of a WHERE clause within a LINQ query. Here is my code var result = from a in xxxx select a; if(!string.IsNullOrEmpty(personName)) { return result.Where(a >= a.forename.Contains(personName) || a.surname.Contains(personName) } else if(!string....

How do you make a crystal report from a dataset programmatically

I have created a dataset and intend to use it in my crystal report but thing is when i preview the data in the dataset i see it but on the crystal report it only shows the column names only and no data shows... ...

Server side include external HTML?

In my asp.net-mvc application I need to include a page that shows a legacy page. The body of this page is created by calling an existing Perl script. This Perl script is externally hosted. Is there a way to do something like this: <!-- #Include virtual="http://www.example.com/theScript.plx"--&gt; ...

C#/WinForms: Do I need the IWin32Windows?

When writing WinForms application with proper separation between View- and Controller/Presenter-functionality, I often find myself writing code like this: public void class SomeView:Form{ private void loadFileButton_Click(object sender, EventArgs e) { _loadFileAction.Execute(this); } } public void class LoadFileAction:Action{...

WebRequest.Create throws "Value cannot be null. Parameter name: str" exception

Hi I wrote a wrapper around HttpWebRequest with the constructor : public MyHttpRequest(string requestUrl) { this.webRequest = (HttpWebRequest)WebRequest.Create(requestUrl); } when I pass a vaild url that works in IE : http://www.google.co.il/search?q=%D7%A9%D7%9E%D7%A8+%D7%97%D7%A1%D7%95%D7%9F&amp;ie=utf-8&am...

How would you name these? (BLL method, DAL method, SP)

Here's what this chunk of code does: Pulls back the 6 most recent members and displays a gallery on the home page -- photo, age and location. My struggle here is whether I should be referencing anything in the SP/DAL method that says "gallery". The data layer only cares about the data, it shouldn't even know a gallery exists. So my in...

Dealing with SerializationExceptions in C#

I get a SerializationException: (...) is not marked as serializable. error in the following code: [Serializable] public class Wind { public MyText text; public Size MSize; public Point MLocation; public int MNumber; /.../ } [Serializable] public class MyText { public string MString; public Font MFont; ...

How to properly handle errors in an n-tier application?

I have struggled with this since day 1. It probably doesn't help that I've been surrounded by a lot of code that doesn't even handle errors at all. Anyway, I'm working with WebForms in your traditional n-tier design: UI->BLL->DAL. Usually what I do (and I know it's not right) is to try/catch my data operations. If there is an excepti...

Rebase a 1-based array in c#

I have an array in c# that is 1-based (generated from a call to get_Value for an Excel Range I get a 2D array for example object[,] ExcelData = (object[,]) MySheet.UsedRange.get_Value(Excel.XlRangeValueDataType.xlRangeValueDefault); this appears as an array for example ExcelData[1..20,1..5] is there any way to tell the compiler to re...

What are the pros and cons of writing a Facebook application in .NET?

I am beginning to write a Facebook application. I have read many articles about the subject and have learned that Facebook has an official PHP API, and .NET has a Facebook toolkit from Codeplex. Both options have many references and resources, but it seems that Facebook itself was written in PHP, not .NET. So does PHP or .NET have bett...

Getting initial dimensions from inherited UserControl

I am trying to create a series of UserControls that all inherit from a custom UserControl object. One of the key behaviors I want to implement is the ability to dynamically resize all of the controls to fit the control size. In order to do this, I need to get the initial width and height of the control to compare it to the resized dime...

AcceptsReturn equivalent for WebBrowser .NET control

Hello, I have a Windows .NET application and one of the forms has a WebBrowser control, an OK button and a Cancel button. The WebBrowser control hosts a TextArea html element, so I can write inside. If the OK button is the form's AcceptButton (form.AcceptButton = btnOk) then when I press Enter the event is captured by the form, and no...

How can I Persist MDI Layout in .NET?

I'm writing an MDI Application in C#. I'd like a way to store the positions and contents of all the open windows, so that a user can customize the way multiple documents are viewed. Is there a simple way to do this, or will I have to roll my own solution? ...