.net

How Can i Fetch a Customized Folder Path using GetFolderPath?

string downloadArea = Environment.GetFolderPath((Environment.SpecialFolder.MyDocuments) + "\\My Personal Documents\\CVs"); I'm trying to get the path ends with .....\My Personal Documents\CVs My Personal Documents and CVs are folders that reside under MyDocuments. The above code gives me a compiler error that says: The best overl...

Entity Framework - An item with the same key has already been added. - Error when trying to define foreign key relationship

I have an entity with a foreign key relationship to an asp.net membership provider users table. This portion of the model looks like this: I can't seem to assign the foreign key relationship when inserting the Users table record, the record containing the foreign key to the aspnet_Users table. I keep getting the error: An item w...

I hear all this buzz about Captcha alot, what is it for?

I hear all this buzz about Captcha alot, what is it for? I mean basically it's just generating bitmap images of a random string and validating it from a user. Is it more than that? Any problems that we face building such a system?I had worked on such a system using .NET and was quiet general, are there any other things that we have to ke...

Find matching bracket with Regex

The input is a string representing a list of elements. A list is defined as an open curly { followed by 0 or more elements separated by whitespace followed by a closed curly }. An element is either a literal or a list of elements. A literal is a succession of non-whitespace characters. If an element contains a curly bracket, it must ...

Adobe PDF Reader component (AcroPDF.dll) - is it possible to access table of contents and bookmarks from code?

I'm using the above DLL in my .NET project. It seems to make different functions accessible, but I can't find bookmarks and table of contents. Is it possible to access those? Also, any manuals/guides available for this component? ...

Validation of Viewstate MAC failed. Using .Net Framework 3.5. Not using form action.

Hi Guys, I know this question has been asked million times but I think my situation is different here. I am using .NET Framework 3.5 SP1, there is no form action on the page and it's not happening when I try to submit the form quickly. I am not on a web farm either. I have a page with two GridViews. One Gridview acts as a master gridv...

Is there any way to hook-up all http requests from all browsers using .NET?

I'd like to have an app which would have access to all requests send from any browser at the current pc. I don't want to have any kind of a proxy server,beacuse you have first adjust the browser settings. Is this even possible using .NET ? ...

SharpSVN diff example for C#

Hi there, Can anyone please provide a small example using diff? I'm trying to use Diff(SvnTarget source, SvnRevisionRange range, Stream result), but I can't find the way to actually see the differences. Thanks, Noa ...

Weird behaviour with conditional operator in .Net

This has me pretty stumped. Maybe I'm too tired right now. Rectangle rectangle = new Rectangle(0, 0, image.Width, image.Height); Rectangle cropArea = inputArea == null ? rectangle : inputArea.Value; if (inputArea == null) cropArea = rectangle; inputArea is a nullable Rectangle, which in my particular case is null....

Graph visualization of existing .NET code

I've seen that VS 2010 Ultimate can generate model graph from existing code. But VS 2010 Ultimate version costs 11K US$, way too much for my budget. Is there any good alternative to do graph visualization of .NET code? ...

C#: Monitoring non-dynamic method calls when working with child classes inheriting from DynamicObject

Let's say I have a class which inherits from DynamicObject: public class DynamicBase : DynamicObject { public override bool TryGetMember(GetMemberBinder binder, out object result) { //Yadda yadda yadda } //same for TrySetMember } and then I have a child class which inherits from DynamicBase: public class ChildCl...

What needs thread-safe code here?

Lets say we have an object that can be accessed by multiple threads and a global singleton handing out the object's reference, also accessible by multiple threads. class Book { private string title; public Book(string title) { this.title = title; } public string Title { get { return title; } } } class Bookstore...

.NET programmatically locate text box in ActiveX control, modify its text and submit it

I have an ActiveX control (Adobe PDF Reader) with a toolbar. This control doesn't expose some functions available through toolbar (mainly search function). I'm looking for a way to programmatically locate Search field on the toolbar, enter the text and invoke search (equivalent of pressing Enter in this field). What's most accurate way t...

Is it possible to extend function from library in such case?

I have a .Net library. say with 2 public functions. say one is Summmator which takes 2 arguments and does A+B. Another function simpleMultiplicator which takes 2 arguments: a number to multiplicate and count of times it should be multiplicated. A simpleMultiplicator function when called uses Summmator function. So it is my library. It is...

Are there any permission issues if I try and write to AllUsersApplicationData

I have an encrypted connection file I want to make accessible to a couple of different applications, and I want to make it available to all users of the machine my apps are installed on. I'm thinking of writing it to my "Company" root folder within the My.Computer.FileSystem.SpecialDirectories.AllUsersApplicationData path, by which I me...

Why are immutable objects thread-safe?

class Unit { private readonly string name; private readonly double scale; public Unit(string name, double scale) { this.name = name; this.scale = scale, } public string Name { get { return name; } } public string Scale { get { return scale; } } private static Unit gram = new Unit("Gram", 1.0...

BadImageFormatException during .Net assembly load issue

...

C# / .NET: Move to desired Item in BindingNavigator

I'm using such a BindingNavigator to let the User move through Data Records of a BindingSource. How can I change the displayed page to a desired page number through the program? I already set the PositionItem to the desired page number, but that just changes the displayed page number and doesnt move to this page. I'm sure it's not di...

How to Automate a WCF Service that does a job in regular intervals

I have a WCF Service that does a job on a request from client. I need that WCF Service to do a preprocessing on regular intervals on a day before it can service the requests coming from client. How can i automate my wcf service so that it does the preprocessing on regular intervals? ...

XtraLabel DataBinding

I using XtraRepo rt to creating report. I add two labels in designer with names: lblCategoryName and lblCategoryDescription. Data binding and show preview: public class Category { public string CategoryName { get; set; } public string CategoryDesciption { get; set; } public Category(string name, string ...