.net

iTextSharp everything works but getting strange error when opening pdf document

Hello everybody, I am using iTextSharp to create my PDF document on the fly. Everything works fine, and i get no errors in the code; however, when i open created PDF it gives me error saying that document will be not displayed properly because it contain errors. Here is the code bellow that gives me a problem: public class pdfevents :...

C# - Naming a value combined "getter/setter" method (WebForms & Binding)

Looking for some help on some names for a project I'm currently working on. I don't have a compsci degree so I don't know what to call this. I have a method called TryToGetSetValue(Direction direction, object value, object valueOnFail) Then there would be a Direction enum public enum Direction { ModelToForm, FormToModel } Ba...

Get the string name of an enumeration or class without namespace?

So, I'd like to get the name of an enumeration or class without the full namespace appended on to the front of it... For example: enum MyEnum { // enum values here } // somewhere else in the code string testString = ???? // ???? returns "MyEnum" typeof(MyEnum) mostly works, however the namespace of the enumeration is appended t...

Why "\d+{1,4}(?:[.,]\d{1,4})?" in RegularExpressionValidator throws Exception: "Nested quantifier {"

I have asp:RegularExpressionValidator with ValidationExpression="\d+{1,4}(?:[.,]\d{1,4})?" but it doesn't' work, parser throws ArgumentException: parsing "\d+{1,4}(?:[.,]\d{1,4})?" - Nested quantifier {. Where is my mistake? I want to allow strings like xxxx,xxxx - from 1 to 4 digits and decimal digits are not required, e.g.: 100...

Using Apple’s Bonjour service from .NET?

I have an iPhone app that publishes through Bonjour. The Mac counterpart works, they sync and exchange data. Now I have to port that little Mac app to Windows. I’ve decided to go with .NET (because that’s what I know). The app is not complex, but I’m in the early stages. I need to browse/discover Bonjour services. For this task, I’ve d...

Prevent mapping all public members of a class in Fluent NHibernate

I have a class generated from a WSDL that has a bunch of public properties and a public event. I'm extending this class with my own and adding some properties to it. All of my own properties are declared virtual, but the base class properties are not virtual. I'm using Fluent NHibernate's ClassMap to map only the properties from my exte...

condition in recursion - best practise

hi there! what's the best practise to break a loop? my ideas were: Child Find(Parent parent, object criteria) { Child child = null; foreach(Child wannabe in parent.Childs) { if (wannabe.Match(criteria)) { child = wannabe; } else { child = Find(wannabe, criteri...

How to reduce Entity Framework 4 query compile time?

Summary: We're having problems with EF4 query compilation times of 12+ seconds. Cached queries will only get us so far; are there any ways we can actually reduce the compilation time? Is there anything we might be doing wrong we can look for? Thanks! We have an EF4 model which is exposed over the WCF services. For each of our entity typ...

Which is preferred: new Nullable<int> or (int?)null ?

Which way is preferred in expressions like this: int? Id { get { int i; return Int32.TryParse(Request["id"], out i) ? i : (int?)null; } } is it better to cast on null or create a new Nullable<T> ? ...

How to pass binaries built upstream to a remote downstream build slave

We're using Hudson on Windows to build a .NET solution and run the unit tests (NUnit). Hudson is thereby used to start batch files that do the actual work. I am now trying to set up a new test that is to run on a build slave and will run very long. The test should use the binaries produced by the upstream build. I have searched the H...

Load image in PictureBox before make control visible.

Hi, I have a form with black background, with 9 picture boxes. When the program starts, I want to show 9 images using these picture boxes. However, the picture boxes take time to load the picture. It is quite ugly that the picture boxes show up first while waiting. Is there a way I can move from blank black screen to straightaway 9 im...

aspdotnetstorefront question

I need to add a field to the following page - before the subtotal it should display the price per item. http://www.culinarydepotinc.com/ShoppingCart.aspx?add=true&amp;ReturnUrl=showproduct.aspx%3fProductID%3d38833 Anyone familiar with this product - I'm using version 7. My question really is, which file i need to modify to implement t...

implemented a program that generate non transferable licence

Hello, I'm taking a security class and required to implement a licensing server that send licenses that are non -transferable. I have no idea how to do that, could you please give me some of your ideas. Regards, ...

Problem setting up T4MVC and MVC 2

I'm setting up T4MVC for MVC 2 on my website. I get 2 build errors: No overload for method 'RenderAction' takes 3 arguments in T4MVC.cs and No overload for method 'Action' takes 3 arguments in T4MVC.cs These are the ones in the T4MVC.cs file: public static void RenderAction(this HtmlHelper htmlHelper, ActionResult result) { ...

Receiving POST data in ASP.NET

Hi, I want to use ASP for code generation in a C# desktop application. To achieve this, I set up a simple host (derived from System.MarshalByRefObject) that processes a System.Web.Hosting.SimpleWorkerRequest via HttpRuntime.ProcessRequest. This processes the ASPX script specified by the incoming request (using System.Net.HttpListener t...

.NET Regex pattern?

var flashvars = { "client.allow.cross.domain" : "0", "client.notify.cross.domain" : "1", }; For some strange reason does not want to be parsed with this code (in C#). private void parseVariables() { String page; Regex flashVars = new Regex("var flashvars = {(.*?)}", RegexOptions.Multiline | RegexOptions....

Problem Binding to a Brush Property in WPF

Working in WPF, writing a custom user control. I am trying to change the background property of the Border element when I change the value of a property of the class. Right now I am working on simply binding it to a DP, though if there is a better way I am open to suggestions. Here is the XAML for the UserControl <UserControl x:Class="...

copy a text file

I am trying to copy a text file in an other text file line by line. It seems that there is a buffer of 1024 character. If there is less than 1024 character in my file, my function will not copie in the other file. Also if there is more than 1024 character but less a factor of 1024, these exceeding characters will not be copied. Ex: ...

Can I safely move my project to .NET 4.0?

I've migrated my project to VS2010 but have not yet targeted .NET 4.0. It's currently targeting 3.5 SP1 (and CLR 2). The project relies on several third party components -- mostly open source -- that were presumably built against the 2.0 CLR. Can I simply retarget my project to the 4.0 runtime? Or do I have to get new versions of all...

MissingMethodException in C# Program

I wrote a Windows Form Application in C# and it works well for my computer. But on another PC, an error occurs when I try to do some stuff. MenuItem_Click Event Handler private void rUNToolStripMenuItem_Click(object sender, EventArgs e) { MessageBox.Show("I'm in rUNToolStripMenuItem_Click!"); ... } ToolStripMenuItem Event Ha...