.net

Setup a private path for loading plugin assemblies

I am working on an app that will load plug-ins. The plug-in assemblies reside in a directory that is below my app's main directory. Looks like this: MyAppFolder ----------->ThePluginFolder ----------------Assembly1 ----------------Dependency1 My problem occurs with Dependency1 (this is an assembly that Assembly 1 references). The ...

Filtering Active Directory Users in Alphabetical Order

I've got to modify a property in active directory for each user throughout the company I work for. This is the code that I am user to get all users. String domain = Properties.Settings.Default.ADConn; String user = Properties.Settings.Default.ADAdmin; String pass = Properties.Settings.Default.ADPass; Di...

Allow certain characters in certain positions in text box (vb.net)

For example I only the second character in each line to be an x, while the 3nd to 10th character must be a hex digit. At the moment I use a Select Case, then check the position of the caret (using textbox.selectionstart) and see if the key being pressed is a "legal" character. Is there a better way of doing this as it slows down on larg...

Default values in WPF DataBinding ?

Can we set default values in WPF DataBinding? e.g : I've bound the Height and Width of my window to some properties as follows. <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" x...

Is there a "coroutine" feature in VB?

I'm programming a application and am wondering, is there a co-routine (or something similar) feature in VB? In my application it pulls a picture from the internet and it takes quite a long time (30-45 seconds) and it stops all code from running while it does that. Here is the line of codes that pulls that picture: PictureBox1.Image = ...

WPF Datagrid virtualization and auto height (not explicit).

I am trying to design a view with a datagrid a grid splitter and a bottom panel that contains some messages. Something like: <Grid> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="10"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <toolkit:DataGrid Grid.Row="0" {deta...

How to run Console Application in Background (no UI)?

Possible Duplicate: .Net Console Application that Doesnt Bring up a Console I have a console application written in VB.NET that will become a scheduled task on a web server. It will run every ten minutes. The problem is that every ten minutes it displays the empty black CMD window while processing, which can be distracting. ...

Convert DataTable to Linq

I'm trying to convert DataTable to Linq using DIm result = From r in dt.AsEnumerable() Select new ( col1 = r.Field<integer>("id"), col2 = r.Field<string>("desc")) But i get error near 'new (' saying type expected. What is wrong with this query? ...

Designer resets property value

I have a problem setting a default value on a property, that is "updated" by Visual Studio Designer every time the form is modified in it. Situation: class MyHour { MyHour() {} MyHour(string h) {} } class MyPanel { _FirstHour = new FirstHour("13:00"); [DefaultValue("13:00")] Hour FirstHour {get { return _Firs...

How do I stop a thread from terminating within a particular section of code?

I a total threading n00b and I want to figure out a way to shut down a thread first by asking nicely, then by force. I have a ProcessManager class that starts a bunch of Process class threads: public class ProcessManager { private IProcessRepository _processRepository; private List<Thread> _threads = new List<Thread>(); pu...

XmlWriterSettings have no effect on XmlWriter created from XmlDocument

I need to use ISO Latin 1 encoding, but using the code below the writer settings defaults back to UTF8. What am I missing here? XmlDocument xmlDoc = new XmlDocument(); XmlWriterSettings settings = new XmlWriterSettings(); settings.ConformanceLevel = ConformanceLevel.Auto; settings.Encoding = System.Text.Encoding.GetEncoding(28591); usi...

EventLogReader Remote Performance

I am using the EventLogReader to query remote 2008 servers for events. The performance of querying the events on a remote machine is horrible (6/sec). If I query the same machine via WMI using a forward-only ManagementObjectSearch the performance is great (1000/sec). I don't see any similar options on the EventLogReader (e.g. ReturnImmed...

TreeView text clipped if font changed from bold to regular

I have a WinForms TreeView. The TreeView represents a summary of more detailed views and one of the visual cues I am using is to make a node's text bold or regular. The trouble is, if you change a node's font from regular to bold it clips the text as if it is trying to fit the bold text in the space for the regular text. A bit of browsi...

how do I convert a pdf to a bitmap image in .net?

Looking for solution to convert a specified page of a pdf file to a bitmap image. ...

Based on what precedence rules is a[x].SomeMember evaluated as (a[x]).SomeMember and not…?

a) Both dot operator ( a.x ) and index operator ( a[x] ) have the same level of precedence. So based on what precedence rules is an expression a[x].SomeMember evaluated as (a[x]).SomeMember and not as (a.SomeMember )[x]? b) Is casting operator an unary operator ( and thus has lower precedence than dot operator ) and for that reason is a...

How to Load & Save to val's in app.config file ?

How to Load & Save to values in app.config file ? For example: to save & to load Connection string ...

How is an array type declaration 'new int[10][]' evaluated?

a) How is an array type declaration new int[10][] evaluated? Is it evaluated as (new int[10])[] or as (new int[10][]) or …? b) I’m not sure how to ask this: I know statement int[][] i = (new int[10])[] would give us compiler error. But assuming compiler wouldn’t report an error, what kind of array type would compiler create based on ...

Backup SQL 2008 DB to restore on SQL 2000 .NET

We have cutomers interested in sending their Sql 2008 data to other customers with SQL 2000. Now obviously this does not currently work, so I'm attempting to create a "generic" backup process that allows us to backup and restore our data on Server 2000 and up (since SQL2000 is the least common denominator of all or customers). Right now ...

How to prevent your code from becoming obsolete?

Some programmers here have been developing a project in VB6, and they say they now need to upgrade to vb.net if they want their apps to run on newer/future systems as vb6 is going to be history soon. So there is this huge application they have been working on that they are going to have to rebuild from scratch (they tried to use the upg...

Repository Pattern in C#

I am trying to figure out the repository pattern for .NET. I think I have a pretty decent understanding of it, but I still don't feel comfortable using it. I have googled for this topic, but found some advanced topics along with the repository pattern. What I am looking for is a basic knowledge of the concept, then I can build on it. ...