.net-2.0

Regex to validate filename

Hello. If filename has another characters then this `a-zA-Z0-9!@$%^,.` we must replace them in some character or delete. ...

How to mock arbitrary behavior with Rhino Mocks?

Hi all, I'm trying to mock a data layer method. The method takes a string and two lists as arguments, and the method populates those lists from the results of a stored proc. Also, I'm still on C# 2.0 with VS2005, and I'm using Rhino Mocks 3.5 for .NET 2.0. If possible, it would be nice to use the AAA format. So yeah, all I want to do ...

How to wait for a file to be copied completely?

I have a thread which polls a folder for new files. The problem is that it sees a new file and starts working on it even before the file has been completely copied by another process. Because of this the poller gets file used by another process error. Is there a way to check the file is free to use or get notified? We can certainly use ...

C# How do you get the operating system architecture (x86 or x64)?

Possible Duplicate: How to detect Windows 64 bit platform with .net? How can I retrieve the operating system architecture (x86 or x64) with .NET 2.0? I have not found any good method to get the OS architecture on Google. What I found was how to tell whether the process is 32-bit or 64-bit. If there isn't anyway to find out i...

DotNetOpenId and Asp.net 2.0 or Visual Studio 2005

I need to upgrade to 2010 Visual Studio, until then.. it is even possible to use the DOTNETOPENID code with Visual Studio 2005 / Asp.net 2.0 or even VS 2005 .net 3.5? http://code.google.com/p/dotnetopenid/ I can not load the sample code included with ASP.net 2.0 and Visual Studio 2005.. can anyone help or make suggestion? It seems to r...

How can I check the final type of a variable?

I have a BaseClass, a DerivedClass1 and a DerivedClass2 from a third party library. DerivedClass1 and DerivedClass2 both inherit from BaseClass. There's a ContainerClass, from the same library, with a member variable ActiveItem, which can be of DerivedClass1 or DerivedClass2, so it is declared as BaseClass. I want to know if ActiveItem...

Regex to parse out filename and partial path, conditionally

I have a C# app that uses the search functions to find all files in a directory, then shows them in a list. I need to be able to filter the files based on extension (possible using the search function) and directory (eg, block any in the "test" or "debug" directories from showing up). My current code is something like: Regex filter = n...

OData client for .Netframework 2.0

Is there a client that I can consume OData service in a .Netframework 2 application? Haven't found a clear answer / example. ...

two different DLL with same namespace

I have two DLL file that they both have a same namespace but they have different functions and types. how can I references both DLLs in my Project and use their functions and types? by the way. these two DLL have some functions and types with same name and different implementation and some unique functions and types ...

DataGridView and DataBinding with custom columns

My requirement is as follows, I am calling a procedure and I'm populating a DataTable. Assume that the procedure is returning emp_id, emp_name, designation and status. When I use DataGridView1.DataSource = <Name of the DataTable>, I get all the columns populated into the DataGridView. How can I display only selected columns in the DataGr...

WIA can not find my internal camera in windows 7

I am currently working on a project where I need to access a build in camera (software will run on a tablet), stream what the camera is showing, and allow the user to take a picture from the stream. I have a version of what I am trying to accomplish on my laptop with its built in camera working. The major difference is the Laptop is usin...

Invert an Enumeration in VB.NET

I need a NOT operation on Enumeration in VB.NET (.NET 2), is it possible? <DefaultValue(0)> _ Public Enum Orientation Descending = -1 Undefined = 0 Ascending = 1 End Enum by ex define a Not operation in order to do myObj1.Orientation = Not myObj2.Orientation Rules: Desceding > Ascending, Ascending > Desceding, ...

Infragistics license file add itself to project!!?

I have a solution in VB.NET .NET 2 Use Infragistic componets all over the application. One day decided to add floating toolbar support to our Forms. Our forms inherit one base form BaseForm. This base form is used in multiple projects in the solution. So, on the BaseForm was added a UltraToolbarsManager. Since, a nightmare began: th...

DataGridView binding problem: "Index -1 does not have a value."

I have a datagridview bound to a binding source and a couple buttons on a form. One button adds an item to the binding source, the other removes the currently selected item. There's also an event handler that listens to the CurrentChanged event and updates the Enabled status of the Remove button. Everything is hunky dory until I go to ...

error CS0006: Metadata file 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\...\some.dll' could not be found

Hi, I am experiencing this problem very often at my hosting server. The error starts happening occasionally for random DLL and until I ftp the web.config file again (even the same file), the error goes and the site starts working fine. I am posting the exception and stack trace below. Please help... Exception: error CS0006: Metadata...

.NET: How to pass command-line parameters with a temp file name

This is .NET 2.0 WinForms. I have some code like so string str = Path.GetTempFileName(); Process p = new Process(); ProcessStartInfo psi = new ProcessStartInfo(); psi.Arguments = str psi.FileName = <some executable > p.StartInfo = psi; p.Start(); Now on the "started" process I get the temp file name by saying args[0]. On Win XP this ...

Visual Studio 2010 managed c++ targets .NET 2.0 PROBLEM

For someone who's been down this road, please share your breadcrumbs. I have old VS2005 solution. Most of the parts are c# but I have one c++ managed project. Dev machine: Windows XP. Target framework version: 2.0 I moved the project to the Windows 7 64 BIT, VS 2010, did the project conversion. First thing I noticed were build erro...

what determines .NET date formats in C# program?

I made a simple web service which worked nice with few systems that it was deployed. Now the date from Oracle causes trouble on other system. Some info: Our own methods that accesses oracle returns dates as string in format 15.09.2010 13:15:00 (note year in 4 digits) System working: -DateTime.ToSring() produces 16.09.10 14:15:49 (us...

retrieve value inside certain pattern

hi folks., i have a pattern as like this "The world is #bright# and #beautiful#" i need to retrieve the string "bright","beautiful" inside # # .. any pointers My solution (thanks to Bolu): string s = "The world is #bright# and #beautiful#"; string[] str = s.Split('#'); for (int i = 0; i <= str.Length - 1; i++) { ...

How to Testing with proxy servers

I have some code in .NET V2.0 that is talking to an asmx service As a related issue I also have some code in the same winforms app that is doig BITS uploads We are a very small shop and quite frankly do not have any sort of proxy server setup But of course our clients will I want to test with a proxy server sitting between my home FIOS...