.net

Populating PDF fields in .NET without a API, such as iTextSharp

class mineTest { string pdfTemplate = @"c:\us.pdf"; public mineTest(Customer c, string output) { StreamReader sr = new StreamReader(pdfTemplate); StreamWriter sw = new StreamWriter(output); string content = sr.ReadToEnd(); content.Replace("(Customer name)/DA(/Ve...

Add Image to Base64 Encoded ImageStream in Resources (resx)

I'm working on an older project, updating it. Part of the program has a toolstrip with many buttons on it, each with an image. I found that the images are stored in a Base64 encoded imagestream in the resx for the form and accessed as such: System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentR...

How can I add a computer to a domain programmatically (using .NET)?

I need to write a program or script that does a few things with (or to) a server after a Windows install. Among those is adding the server to a domain. Is there a way to do this programmatically or using a script command? ...

Where should I handle the exceptions, in the BLL, DAL or PL ?

Which is the best place to handle the exceptions ? BLL, DAL or PL ? Should I allow the methods in the DAL and BLL to throw the exceptions up the chain and let the PL handle them? or should I handle them at the BLL ? e.g If I have a method in my DAL that issues "ExecuteNonQuery" and updates some records, and due to one or more reason, ...

Understanding ItemsSource and DataContext in a DataGrid

UPDATE: See the bottom of this question for what I did to solve the problem. I'm trying to understand how the ItemsSource and DataContext properties work in a Silverlight Toolkit DataGrid. I'm currently working with dummy data and trying to get the data in the DataGrid to update when the value of a combo box changes. My MainPage.xaml....

sql connection string from AD account in web.config

Infrastructure has created an active directory account for me that has read access to the SQL 2008 database I need to query. The web application I've created does NOT use this account to run so I can't use Identity Impersonate="true" to access my datasource. Is there a way in my connectionstrings node to just input the AD UN/PW combina...

Avoiding mass propagation of properties and events for exposure to ViewModels.

I have an MVVM application I am developing that is to the point where I'm ready to start putting together a user interface (my client code is largely functional) I'm now running into the issue that I'm trying to get my application data to where I need it so that it can be consumed by the view model and then bound to the view. Unfortu...

BlockingCollection(T) performance

For a while at my company we've used a home-grown ObjectPool<T> implementation that provides blocking access to its contents. It's pretty straightforward: a Queue<T>, an object to lock on, and an AutoResetEvent to signal to a "borrowing" thread when an item is added. The meat of the class is really these two methods: public T Borrow() ...

WinForm Text Control that displays current character/character limit

I need a way to display, like you see in some web apps, the current characters/character limit for a Text Control(i.e. 3/500). I usually see this as a label residing directly above or below the Text Control. How is this 'normally' accomplished? Should I override my Text Control somehow? Do I just manually add labels by every Text Con...

How do I set the ItemsSource of a DataGrid in XAML?

I'm trying to set the ItemsSource property of a DataGrid named dgIssueSummary to be an ObservableCollection named IssueSummaryList. Currently, everything is working when I set the ItemsSource property in my code-behind: public partial class MainPage : UserControl { private ObservableCollection<IssueSummary> IssueSummaryList = new O...

Getting attachments from a mail account with .NET

I'd like a free library for .NET to get attachments from an account (such as gMail, or others) via imap4 (not necessarely), and save them in a folder. Ideally it would allow me to get a list of them, and download only some given ones (filtering by extension, name, and/or size) and be free. I've already done this with a trial version of...

Java EE 6.0 and .NET 4.0 comparison

We are running our applications on .NET 3.5 and are planning on either updating to .NET 4.0 or switching entirely to the Java platform, Java EE 6.0, as we've heard from some clients that "it's better." Can anyone either explain some of the large differences between the two platforms and maybe what kind of costs would be associated with ...

How do I add a new ItemTemplate to a Guidance Automation Toolkit vs2010 .vsix package?

I have a vs2008 GAT package that has been updated to work on vs2010 which walks a developer through creating a custom solution complete with a Service layer project, Domain, usercontrol, and unit test project. I'd like to add a new ItemTemplate to the package to create a user control or dialog that adheres to our current practices. So f...

How to select ComboBox value after Data filled from DataSource

Hi, I would like to set the selected value to a known value. However, after InititializeComponent() has been called, the data is not yet filled in a databound Combobox so I can't set my selected value there. Which event is triggered when the data has finished to be added in the combobox from the databound object ? Is there any other ...

How-to diagnose and fix such "on-site" crash of dotnet application?

Hello! I'm working on some application which has auto-update function. The implemented idea is simple as following: - There are some "starter" application which is installed to "Program Files/whatever/...". It's the application which is intended to be started by user. - Each time the "starter" application is executed it checks server f...

Visual Web Developer 2010 / Sql Management Studio 2008 Express - Database Inaccessible?

When I connect to a database in either of these application, I cannot access the same database in the other application.....until I restart my machine. this is really awkward and I would be grateful if you can help. ...

"is" operator behaving a bit strangely

1) According to my book, is operator can check whether expression E (E is type) can be converted to the target type only if E is either a reference conversion, boxing or unboxing. Since in the following example is doesn’t check for either of the three types of conversion, the code shouldn’t work, but it does: long l; // EDIT -...

What's the simplest and fastest way to draw a parse tree using .Net?

I've written a simple top down parser using c#. It's a console application. I'd like the parser could save, at the end of the computation, an image file of the parse tree. I think I could use graphviz, but I'd like to know your opinion. Thanks. ...

Associating Worksheets with their Names using OpenXML SDK 1.0

I'm using version 1.0 of Microsoft's OpenXML SDK to do some basic parsing of .xlsx files. I can get and parse the worksheets, and I can get a list of worksheet names, but I cannot for the life of me figure out how to link up what name goes with what worksheet. I understand that an element like <sheet name="My Sheet" sheetId="1" r:id="r...

Reactive Extensions memory usage

I have the following code in a WPF application using Reactive Extensions for .NET: public MainWindow() { InitializeComponent(); var leftButtonDown = Observable.FromEvent<MouseButtonEventArgs>(this, "MouseLeftButtonDown"); var leftButtonUp = Observable.FromEvent<MouseButtonEventArgs>(this, "MouseLeftButtonUp"); var move...