.net

Get common desktop path in .NET

I need to store files into the common desktop on Windows. The application is a very special application for exactly one special PC (device preparation), so it had to be easy for non-techie users to find and modify the configuration file. Now we switched to a domain, and because different people (with different accounts) should use the so...

Missing part of query string variable when using URLEncode

Hi, my c# aspx page sends an email containing a link like this: http://akerbrygge.cust.avento.no/default.aspx?lang=3&redirect=default.aspx%3fmenu%3d64%26event_id%3d23 When logged in, I want the user to be redirected to the redirect= part of the url. However, .net only finds default.aspx?menu=64 when I output Request["redirect"]....

Highlight character range in .NET TextBox

Hi folks, is there an easy possibility to highlight a portion of text in a normal WinForms TextBox (I cannot use RichTextBox in this case). All the solutions I came up with so far are very complex and handle drawing the text on their own, including fancy Interop calls... Thanks in advance! EDIT: I don't talk about selecting the text b...

What kind of exception to throw?

Hello. This question might sound a bit stupid but here it goes. I have two functions that can be called at any moment. The first function takes a snapshot, and the second one analyses the data taken from that snapshot. Of course if the user tries to analyse the snapshot before taking it, my application should throw an exception. I know ...

Multithread database access (.NET)

Hi, I'm currently building an app that generates quotes. The total time to generate all quotes is about 10 secs, and at present provides an unacceptable user experience. What I want to do is multi-thread each quote so the user can see results as they come in. The problem is that the app I've inherited does a lot of bus logic on the d...

.NET How to extract embedded image from email message?

Hello I'm working on a project in .NET 1.1 and I have a requirement to extract (and save it somewhere) embedded image from emails that I'm receiving. Can someone give me a clue on where to start? thank you ...

Passing command line arguments to C# projects, from devenv, while building a vdproj

We have a vdproj (Visual Studio Setup File) which references and builds some C# projects. In our build system, we would like to override some properties in the C# projects, when the vdproj gets built. Is there any way to do achieve this? ...

How do I select a C# variable using a string

I have a string user setting and want to select a particular variable with the same name during the startup of my C# Windows app. e.g. I have a user setting (string) called UserSelectedInt, which is currently set to 'MyTwo'. (Please note that my variables are actually a lot more complex types than integers, I've just used them as exam...

Where can I find friendly strings for SQL Server versions?

The friendly string for 9.00.4035.00 is SQL Server 2005 SP3 Express Edition. I would like to convert version numbers to string by accessing only registry or a dictionary. Can I find a list? ...

using classes inside a COM exe from .Net

I have a .exe file I've been given which has COM classes inside it -- these are from C++, not .net ComVisible types I'd like to use those classes inside my .net project, but I can't add a reference to the exe; when I try I get DIALOG BOX: --------------------------- Microsoft Visual Studio --------------------------- A reference to ...

.NET Multithreading - Do I need to synchronise access to a variable of primitive type?

The scenario I have a class with a bool Enabled property, that is used by a loop on another thread to see whether it should stop or not. The idea is that a different thread can set that property to false and stop the other thread running cleanly. The question Should I bother to serialise access to that Enabled property using somethin...

Encrypt SQLite database in C#

What is the best approach to encrypting a SQLite database file in .Net/C#? I'm using sqlite-dotnet2 wrapper. There are tools like SQLite Encryption Extension and SQLite Crypt, but both are non-free, while my project is under GPL. The naive approach I thought of using was to let SQLite handle a temporary file, then to encrypt it on pro...

When is my destructor called in this circumstance? (C#)

I was wondering when the destructor is called under these circumstances, and if it is will it be called on the main UI thread? Let's say I have the following code, when would the destructor be called, and would it wait until I have finished all my function calls? private void Foo() { MyObject myObj = new MyObject(); DoSomeFunThin...

Reference to a non shared member requires an object reference

hi guys, I have added one class under namespace BusinessLogics. I have inherited System.Web.UI.Page to class and showing error as 'end expected' in System.Web.UI.Page Namespace BusinessLogics Public Class BllUploadImages Inherits System.Web.UI.Page End Class End Namespace How can i remove my error.Can anybody help? ...

Is it possible to draw a shape with a CMYK colour fill in .net?

Is it possible to create an aspx page where the user enters CMYK values, and the CMYK colour will be displayed? I've done some googling and the System.Drawing library seems to use RGB. ...

Simple regular expressions questions

Hello. I have two simple questions about regular expressions. Having the string "$10/$50", I want to get the 50, which will always be at the end of the string. So I made: ([\d]*$) Having the string "50c/70c" I want to get the 70, which will always be at the end of the string(i want it without the c), so I made: ([\d]*)c$ Both seem do ...

How can I supress static code analysis during build?

We have a solution with 15 projects, which all has code analysis enabled. The solution easily takes 60+ seconds to build, which is a very long time when sitting waiting. If I disable code analysis it builds in 10 sesonds. I would love to be able to disable code analysis on an ad-hoc basis. But still I want code analysis when building ...

In which CLR my code will execute?

Consider I am having two versions of .Net(.Net 1.1,2.0) in my developement machines. If I am deploying my application X against .Net 1.1 and deploying another applicatin Y agaings .Net 2.0 framework. Now I need to know in which CLR(1.1 or 2.0) my both applications will run? Also state me the reason? ...

How do I implement a progress bar in C#?

How do I implement a progress bar and backgroundworker for database calls in C#? I do have some methods that deal with large amounts of data. They are relatively long running operations, so I want to implement a progress bar to let the user know that something is actually happening. I thought of using progress bar or status strip label...

How to edit application .NET config files from external application

Hello, Our main .NET application uses standard .NET XML config files for storing all the settings. Lets call our app: APPMAIN. As you probably know this means that all default settings are stored in the readonly app.config file. At the moment the application changes a user setting, a new file will be generated (user.config) that contain...