.net

Retrieving an accurate string array from a RichTextBox control

Guys, I have a RichTextBox control on my form. The control is setup in such a way that it will wrap to the next line after 32 lines of text are input. The problem I'm having is I want to be able to retreive an array of strings representing the lines in my control. I know there is a Lines property attached to the RichTextBox, but I am ex...

MSWord Richly Formatted Text Paste into Webgui Text Input Field for Database Submission

I have several richly formatted paragraphs in a Word 2003 document. How do I copy each paragraph and paste it in a text input field with all the formatting in place? The main objective is to make each paragraph as an object in the database so users can add and rearrange these objects(paragraphs) in custom order to generate their custom ...

Simple sql to Linq query with group by and aggregate functions

I'm fighting with linq trying to learn the syntax and I can't figure out how to do the following simple query SELECT DISTINCT user.firstname, user.lastname, COUNT(invoice.amount), SUM(invoice.amount) FROM company_user INNER JOIN user ON company_user.user_id = user.user_id INNER JOIN ...

Castle Windsor DynamicProxy Interception IInvocation Documentation

On a Castle Castle.DynamicProxy.IInvocation, what's the difference between GetConcreteMethod GetConcreteMethodInvocationTarget Method I read the documentation, but I don't understand the difference, especially between the first two. I'm guessing that Method is just the MethodInfo for the method on the actual registered type? ...

Dynamic Fetch an Inheritance in Entity Framework 4 POCO

Hey guys, Is there anyway to make a dynamic fetch in entity framework 4 If you have some inheritcance where a and b inherit from c Can you call one linq query to get a list of a, and b using the data set for c? ...

Clean Up Vs Memory Reclaim in .Net

I was reading this MSDN reference: Although the garbage collector is able to track the lifetime of an object that encapsulates an unmanaged resource, it does not have specific knowledge about how to clean up the resource. For these types of objects, the .NET Framework provides the Object.Finalize method, which allows ...

fill form automatically

I need to create c# code to go to site, fill in form submit record. I have tried using seleniumhq but this creates tests..I need more of a script i can run once to help me register some users for my site any ideas?? ...

Provide the ability to "hot swap" / change assemblies at runtime without re-starting a process.

ASP.Net allows you to copy new assemblies into the bin directory of an application without needing to re-start any services or processes. I have an application that loads user defined plugins and extensions (some of them are COM based) - I'd like to provide similar functionality (i.e. the ability to change / update an assembly without n...

In Autofac how do I change the instance that is registered after Build has been called?

So lets say i have this code var builder = new ContainerBuilder(); builder.RegisterInstance(new MyType()); var container = builder.Build(); Then some time later I want to change the instance of MyType for all future resolves that are called on container. ...

what does this .net line of code means.

Hi all, I recently shifted from JAVA development environment to .net development environment. I am developing web application using .net MVC framework. Would someone help me to find the meaning of following code segment. It seams like iterating thought list, but I could not find specific definition of this code sample: SmartTextBoxMod...

Funny performance results comparing float and double in C# .net 4.0

I made a small test program that multiplies and adds 10 million numbers. With float it always takes 51ms. With double it takes between 210 and 3310ms between compilations (3310ms happens only every 10 compilations or so). What's going on here? private void button1_Click(object sender, RoutedEventArgs e) { DateTime no...

Process.Start() returns null on own process.

I'm using Process.Start() to initialize an elevated copy of the currently running application. Unfortunately Process.Start() returns null because it thinks it's using an existing process of my application, and while there is an existing process, it doesn't specify any way of handling this kind of entry point. Is there any way in .NET (...

Exception Handling

how we can return some value in try-catch for example try { return abc; } catch(Exception ex) { console.Writeline("Exception occur" + ex); } ...

NUnit's TestCustomException doesn't care about the exception type

If I want to test that a method throws an exception of a particular type, NUnit's ExpectedException attribute doesn't care about the actual type; if I throw a generic Exception before the method call, the test passes: [Test, ExpectedException(typeof(TestCustomException))] public void FirstOnEmptyEnumerable() { throw ...

PDF to HTML/XML Conversion in C#

Hi, There seem to be a lot of tools/components to convert HTML to PDF. I am wondering if there is a .Net component or library that can go the other way around. Given a PDF, convert it into HTML or XML or any other sort of structured format that can maintain layout information such as headings/titles/paragraphs etc. iTextSharp, AbcPDF, ...

"Cannot find the certificate and private key for decryption" for Certificate pfx pkcs#12 with private key

I have the following .Net code (asp.net) for sign using client certificate. I have client certificate stored under local computer and not the current user. The client certificate is pfx pkcs#12 and has private key Imported private key are NOT marked as exportable. my private key in client certificate protected by password. On the ...

How to update object values (based on the curr-previous pattern)?

Assume you have a CSV file with the following simplified structure LINE1: ID,Description,Value LINE2: 1,Product1,2 LINE3: ,,3 LINE4: ,,4 LINE5: 2,Product2,2 LINE6: ,,3 LINE7: ,,5 I am using FileHelpers to read the CSV and have hooked up one the interfaces that allows me me to access the current line, after it has been r...

BackgroundColor of a disabled TextBox

I have a TextBox that is defined through a ControlTemplate. Because of the ControlTemplate, the TextBox is no more automatically grayed out when the IsEnabled-property is set to false. To provide this functionality, I use the following trigger within the ControlTemplate: <Trigger Property="IsEnabled" Value="False"> ...

vs2010 .net 4.0 to .net 3.x

Hello ! I would like to know how can i transform a .NET 4.0 VS 2010 C# project intro a 3.x .NET version? I just made an app for someone and i don't think he has the .NET 4.0 platform installed . Any ideas? ...

Howto clear a textfile without deleting file ?

Question: I have an ini file which I need to clear before I add info to it. Unfortunately, if I just delete the file, the permissions are gone as well. Is there a way to delete a file's content without deleting the file ? ...