.net

Is it possible to call an instance method from a static constructor in WCF service?

Is it possible to call an instance method from a static constructor in WCF service? Is there something like current context through which I can get the current instance of MyService? public class MyService : IMyService { static MyService() { //how to call Func? } private void Func() { } } EDIT: This q...

Validation in ASP.net

I want only letters and the special symbols / and - in my textbox. How should be the expression like to give in custom validator? Thanks In Advance ...

multi-platform regisration-free COM with .NET app

I have a .NET application that uses a COM component. The application itself is "Any CPU", but the COM component has a 32-bit and 64-bit version. The article http://msdn.microsoft.com/en-us/magazine/cc188708.aspx is clear on what to do for registration-free COM. But what should one do for: "Any CPU" app dependent Assembly : Assembly1...

How to find padding space around the label text?

I am adding a label controls at run time. I can add or modify text in label and can change the font also.Now my problem is When i changed the font of text in label, alignment is not proper,its due to padding.Is there any way to find how much padding is ocured [ed: obscured?] based on font? ...

Convert an array of bytes into one decimal number as a string

I'm trying to write function that converts an arbitrary large array of bytes (larger than 64-bit) into a decimal number represented as string in c# and I simply can't figure out how to do it. For example the following code ... Console.WriteLine(ConvertToString( new byte[] { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, ...

Reading data from a particular location of a FileStream using .NET

I am trying to read data from a file stream as shown below: fileStream.Read(byteArray, offset, length); The problem is that my offset and length are Unsigned Ints and above function accepts only ints. If I typecast to int, I am getting a negative value for offset which is meaningless and not acceptable by the function. The offset and...

Where can I set CurrentUICulture in an ASP.NET web page?

I was reading a resource that said: CurrentUICulture must be set at the startup of a application. For an ASP.NET web page, where do I set this property appropriately? ...

Please Recommend a Good .NET Oriented REST book

Hi Guys I'm Curious if somebody could recommend a book about REST that isn't "Effective REST Services Via .NET: For .NET Framework 3.5 (Microsoft .Net Development)". One of my colleagues read it and he wasn't too impressed with it. Can anyone suggest a better one? Thanks Dave ...

How to create trial version of .NET software?

Does Visual Studio have built-in tools for creating trial versions of software? If no what tools can do the job? What are the best practices for creating trial versions on .NET platform? How these practices depend on application type (web applications, Windows Forms applications, dll ect.)? ...

Can SynchronizationContext.Post or .Send lead to exceptions?

Hi I've read all recommended articles on SynchronizationContext, but there is one small question I did not find an answer for. In my case I have an event handler that calls a Log() method that outputs text to a TextBox. Log() is called from a WCF service. The event is raised from WCF client instances (threads). Usually, I check Control.I...

How to create a platform ontop of CSLA? <-- if in case it make sense

Here is the scenario, I'm developing an application using csla 3.8 / c#.net, the application will have different modules. its like an ERP, it will have accounting, daily time record, recruitment etc as modules. Now the requirement is to check for common entities per module and build a "platform" (<- the boss calls it that way) from it....

Generic interface problem

I'd like to have one interface for all my grid related tasks.The tasks implement this interface: public interface IDataForGrid<T> { IGridResponse<T> GetList(IGridRequest request); } The T type is always a DTO class. I cant't create a common interface for this DTOs because they have nothing common.Just a dumb DTO with particular pr...

problem burning DVD using IMAPI2 in Windows XP using c#.net..

i have used IMAPI2 for buring CD/DVD in windows XP..but it is giving me unhandeled exception...it is written as:- System.InvalidCastException: Unable to cast COM object of type 'IMAPI2.Interop.MsftFileSystemImageClass' to interface type 'IMAPI2.Interop.MsftFileSystemImage'. This operation failed because the QueryInterface call on the CO...

c#/.NET SQLite -- REINDEX not working?

Hello all, I'm trying to reindex a table in a simple database that I created using SQLite.NET and VS2008. I need to reindex tables after every DELETE command and here is the code snippet I have written (it does not work): SQLiteCommand currentCommand; String tempString = "REINDEX tf_questions"; //String tempString = "REINDEX [main].tf_...

radgrid autogenerated delete and edit command button, not firing the postback on first click

Hi, I have a radgrid bound to a custom datatable. The radgrid is created in the design, but the Cols are added at runtime in the code depending on some conditions. I have Edit and Delete Columns on the grid to perform the respective operations. Of the rows generated, the bottom half rows do not fire the postabck event completely and ...

How write C# code being safe both under x86 and x64 when accessing COM? Typical traps?

We use an open source library written in C# wrapping Windows BITS COM component. However, the code is only safe to run it in x86 mode. I would like to contribute to the library by making it safe for both x86 and x64, however I have no deep knowledge in this field. Could you please list here good/bad practices, typical issues, maybe pri...

how to open popup window on both side using javascript

hi friends I am developing a chat application here i have kept general chat room here multi users can chat with each other but now i want one to one chat in my application, when logged user click on any user in the user list, one pop up window should be opened on the user computer and another pop up window should be opened in the rem...

Tesseract.NET in C#

Hi, Do you know of step by step guide of how to use bins and dlls in http://www.pixel-technology.com/freeware/tessnet2/ I spent 2 days trying to use this by when compiling i am being asked for a dll that do not exist in the zip file i downloaded from the site. Any help will be greatly appreciated. ...

regex replace - but with a few exceptions.

I have a string containing HTML and I need to replace some words to be links - I do this with the following code; string lNewHTML = Regex.Replace(lOldHTML, "(\bword1\b|\bword2|word3\b)", "<a href=\"page.aspx#$1\">$1</a>", RegexOptions.IgnoreCase); The code works, but I need to include some exceptions to the replace - e.g. I will not r...

Is having an empty base class bad design ?

I need a base class for my DTO classes which will be used in my generic interfaces. But the DTO classes have nothing in common. They are just dumb classes containing some properties. public void GetGridData() { IDataForGrid<DTOBase> aa; if(request == 1) aa = new CustomerGridData; if(request == 2) aa = new OrderGridData; ...