.net

Updating textbox asynchronously

I am creating an email software which send email to some accounts. I want to append text every time new email is sent or failed. But textbox shows me report after sending all emails. If the toList is very large like 30+ emails the app screen goes white and after sending all emails GUI comes back with the updated OutPutTextBox. Here is th...

A Transport-level error has occured when sending the request to the Server.

Do anyone have a REAL and CLEAR way to solve this problem and an explaination of why it happens? Because, every thread i've read on how to solve this issue where not "politicaly correct". I mean, i saw things like "Restart machine, etc" but I get this error on a hosted dedicated server and I can't restart it like that. A transport-l...

release Assembly.LoadFrom file handle

Hi, I'm trying to get assembly version of an exe in C# with the following code Assembly asm = Assembly.LoadFrom(address); return asm.GetName().Version; it works perfect but if I try to delete the exe after I used this function, it says "Access Denied" since the exe is being used by another process! is there any Dispose call or somet...

How to solve the "Cross-thread operation not valid" Problem ?

I have a windows forms dialog, where a longer operation is running (asynchron) within a backgroundworker job. During this operation I want to change some values on the form (labels,...). But when the backgroundworker tries to change something on the form, I get the error "Cross-thread operation not valid"! How can this problem be solved ...

Problem with NumericUpDown type

When i do something like this: public static void BindData<T>(this System.Windows.Forms.Control.ControlCollection controls, T bind) { foreach (Control control in controls) { if (control.GetType() == typeof(System.Windows.Forms.TextBox) || control.GetType().IsSubclassOf(typeof(System.Windows.Forms.TextBox)...

Determining which monitors/displays/screens are attached

In the windows desktop properties all the displays are shown and are indicated to be active or inactive. My graphics card has a monitor connected to the dvi port but not the vga and this is correctly determined (i.e. one of the displays is labelled inactive). I also have a usb displaylink lcd which is also detected. Using system.windows...

Tips for fixing dll version problems in .NET.

Hi all I've just got to grips with the basics of NHibernate, and while refactoring my data access and domain layers I thought I might as well get cute and start using dependency injection for the data access layer. Unit testing here we come! I thought since NHibernate uses loads of Castle dlls I might as well use Castle Windsor for th...

How are explicit interface implementations implemented in IL?

I've been having a look at explicit interface implementations in IL. The method Method in the following class (interface IA has a single Method() on it): public class B : IA object IA.Method() { /* code */ } } is compiled to the following IL method signature: .method private hidebysig newslot virtual final instance ob...

CodeDom compiler does not use executable directory for assembly references

I have a CodeDom setup that needs to reference some assemblies that are in the executable's directory. However, it appears that only the Working Directory and the GAC are searched for these assemblies, and not the executable directory. var compilerOptions = new CompilerOptions { ReferencedAssemblies = { "System.dll", ...

Most productive way to use ViewModels, Data Annotation based validation and Domain Objects?

I am using NHibernate for persistence and have my domain model mapped out. I am using MVC2 and I am keen to use the built in model validation for all basic validation (string length, range, etc). The problem is that I'm finding that there is a huge amount of work involved in this. I have 26 POCO classes representing the domain. Which...

.NET. Minimize memory usage / optimize class design

I have the next class which instantiated about 40 million times and all its instances take about 80% of all process memory (more than 15GB). class MyClass { String Field1 String Field2 String Field3 int Field4 int Field5 float Field6 SomeEnum Field7 Boolean Field8 Boolean Field9 Boolean Field10 ...

What type of add-ins can be developed for Office 2007?

We're thinking of developing a small tasks/to-do list for our team and I wonder if we can develop any type of add-ins we want for Outlook 2007. I mean custom menus for the main toolbar, a new tab/section next to the Calender.. Are there any limitations for what you can do for Outlook 2007 add-ins? ...

Limiting fields in Select statement generated by Linq to Castle ActiveRecord

Hi all! I'm using ActiveRecord and LinqToActiveRecord to query my database. The problem is, that the generated SQL statement from my LINQ expression always tries to select all possible fields, including joined tables, when this is not needed. For example, I have these database tables: Table: MasterTable Id (int) ChildId (int) <- refere...

What's a good alternative to firing a stored procedure 368 times to update the database?

I'm working on a .NET component that gets a set of data from the database, performs some business logic on that set of data, and then updates single records in the database via a stored procedure that looks something like spUpdateOrderDetailDiscountedItem. For small sets of data, this isn't a problem, but when I had a very large set of ...

How to Generate HTML from within ASP.NET MVC?

Hi guys My english very terrible, so i cant explain very clear. I will try my best. is it possible to generate HTML code from within ASP.NET MVC, please? This is Controller public class HomeController : Controller { public ActionResult Index() { ViewData["Message"] = "Hello ASP.NET MVC!"; ViewData["author"] = ...

Why can't I load an image resource from my resx file?

I have a controls library which I've added a .resx file to (ImageResources.resx). It contains two .png images which I subsequently added. In that same library I have a control which loads a couple of images to do some custom drawing, but I don't seem to be able to load the resources: void GTableLayoutPanel::SetBorderImagesFromManifest(...

Expose a class as STA COM

I have a little c# class that I need to expose as COM. THe tool that will use the COM object requires that I support STA. Is there anything special that I need to do with my COM object? (I know about the STAThread attribute, but (unless I'm wrong) It is for indicating that a thread of execution in .net is to be STA compatible, and no...

.Net FTPwebrequest having trouble sending file with ftps - firewall issue

I am trying to send a file via code using FTPWebRequest (ftps,pasv). I am getting the following error: Unable to read data from the transport connection. A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to resp...

How to get email delivery status with webdav

Hi, how can I check if an email is sent using webdav?Is there any delivery status poperty or something like this? ...

Microsoft.Http.HttpClient, sending HTTP authentication parameters properly on redirects

i am making a request to a 3rd party RESTful service using M$'s HttpClient. it works flawlessly (and is very easy to implement) except for this one instance. here is a breakdown from the provider as to what is occurring during the error: "The way the POST to the group resource works is that when it completes, it does a HTTP 302 redirect ...