.net

Prevent a textbox from scrolling when adding text

I'm adding new logs line to a WinForms TextBox object, and this causes the textbox to scroll to the bottom. How can I prevent this and retain my current position? (a short code snippet would help) ...

Timer cannot be stopped in C#

Hello all, I have a timer on a windows form (C# 3.0, .net 3.5 SP1, VS2008 SP1, Vista) that seems to work even after it is stoppped. The code is: using System; using System.Windows.Forms; namespace TestTimer { public partial class Form1 : Form { public Form1() { InitializeComponent(); Sta...

In c# does a locked object stay locked if an exception occurs inside it?

In a c# threading app, if I were to lock an object, let us say a queue, and if an exception occurs, will the object stay locked? Here is the pseudo-code: int ii; lock(MyQueue) { MyClass LclClass = (MyClass)MyQueue.Dequeue(); try { ii = int.parse(LclClass.SomeString); } catch { MessageBox.Show("Error parsing...

What's the use of attributes on an interface?

Duplicate of can a c class inherit attributes from its interface Using Resharper, I extracted an interface of an existing class. This class has some attributes set on a few members, and Resharper also put these on the interface members. Can I delete these attributes from the interface? Attributes on an interface aren't inherited when i...

NHibernate: Column does not allow nulls. INSERT fails

I have 2 entities Person and Address, Person has one Address. EDIT: The Address already exists, Im just wanting to save the foreign key. When I do this: PersonDTO person = new PersonDTO(); person.Age = "Bob"; person.Address = new AddressDTO {Key = 123}; Save(person); I get this exception: Cannot insert the value NU...

Regular Expression

Hi, I want .net regular expression for below thing: user can enter value tcm:12312312-221231323 or tcm:23121231-23423423-34234234 all the entry except "tcm" will be numeric. Please help! ...

Should I learn Openedge as a C# programmer

We have an Progress OpenEdge (http://en.wikipedia.org/wiki/Progress_4GL) develop team in the company I work for. I'm the only c# developer there and really like it. So now the manager asks me to learn programming in OpenEdge. He doesn't want me to become a good OpenEdge programmer but he wants the team members to understand both worlds....

JPEG 2000 support in C#.NET

It seems that .NET can't open JP2 (Jpeg 2000) files using the GDI library. I've searched on google but can't find any libraries or example code to do this. Anybody got any ideas? I don't really want to pay for a library to do it unless I have to.. ...

Getting Started with the Web Client Software Factory But i don't find Solution picture?

i downloaded add start set up MVP Software, After setup finished, i don't find mvp C# solution (like: asp .net mvc solution, or asp.net Silverlight Solution) in list of project type ? i need a list of project list like start up asp.net solution for example: if i click new project, .net give me type of alternative solutions, So i choose...

C#: Declaring and using a list of generic classes with different types, how?

Hi, Having the following generic class that would contain either string, int, float, long as the type: public class MyData<T> { private T _data; public MyData (T value) { _data = value; } public T Data { get { return _data; } } } I am trying to get a list of MyData<T> where each item would be of differen...

Making sure OnPropertyChanged() is called on UI thread in MVVM WPF app

In a WPF app that I'm writing using the MVVM pattern, I have a background process that doing it's thing, but need to get status updates from it out to the UI. I'm using the MVVM pattern, so my ViewModel knows virtually nothing of the view (UI) that is presenting the model to the user. Say I have the following method in my ViewModel: p...

Garbage Collection every 100 seconds

Did any one encountered an scenario where application under high memory allocation load performed second generation collection every 100 seconds ? We using 64-bit server with 8-16 GB of physical memory. Application has several GB of data what is stored in cache and can't be cleaned from it becouse it's actualy used by application. In ...

How do I set the GroupBox caption colour

On my system, the caption of a groupbox is always a dark blue colour, how do I change this? The answer to How do you change the color of the border on a group box? shows how I can override the drawing of the caption and border, but I don't want to have to deal with Visual Styles and drawing rounded corners and the like. ...

Can a standard thread be reused for the Thread Pool?

I'm having some weird behavior in an application which is puzzling me. I create a thread, let's call it worker, which is responsible for handling communication requests. Clients write on a pipe while the thread consumes the requests and send messages. Now, the main loop of the thread has something like this: lock(this) { object_id =...

In .NET, What is the difference between Embedded Resource and Resource ?

Hi Does someone knows the difference between Embedded Resource and Resource ? Because these two resources type are stored in the assembly and accessible with Assembly.GetManifestResourceStream. Thanks, ...

Is Collection(Of T) a 0-based array or 1-based array?

If it's 0-based, how can we add a placeholder to make it 1-based? Thank you. ...

problem with Web.config wiring a database

<connectionStrings> <add name ="MyDB" connectionString ="Data Source=.\SQLEXPRESS" providerName="System.Data.SqlClient"/> </connectionStrings> I've wired the above however I keep getting the following: System.Configuration.ConfigurationErrorsException: The requested database MyDb is not defined in configuration. Is there s...

Do you have to restart a windows service if you change the app.config?

Do you have to restart a windows service if you change the app.config? ...

Tool to compare .dlls and disassemble the differences?

Does anyone know a decent tool that will compare two different versions of the same dll and extract the differences? thanks ...

How do I set the Font color of a label to the same as the caption color of a GroupBox?

I want to have some labels on a form with the same font color as the caption on my group boxes, and furthermore I want these colors to change if the user has applied a different Theme on their system. Can I do this without changing the GroupBox caption from its default? UPDATE: I have tried setting the Label ForeColor to ActiveCaption...