.net

WPF: Set Binding-property for ListBox-binding

I have a listbox where I bind the ItemsSource to a collection stored in the set DataContext object. This makes the list displayed using the ToString() function. <ListBox ItemsSource="{Binding SomeCollection}"></ListBox> Now I want to display a property for the objects in the collection instead. So I want to define a template etc to d...

.NET : How to call CreateProcessAsUser() with STARTUPINFOEX from C#

Hi: Most sample code on the web for calling CreateProcessAsUser() has a similar PInvoke signature to the following: public static extern bool CreateProcessAsUser(IntPtr hToken, string lpApplicationName, string lpCommandLine, ref SECURITY_ATTRIBUTES lpProcessAttributes, ref SECURITY_ATTRIBUTES lpThre...

Web like Desktop GUI in C# winforms.

How can I program a web like GUI for my Winforms Desktop Application? For example, Visual Studio 2008 Start Page. ...

What's the "upgrade path" from Assertion.AssertEquals ?

I've inherited some unit test code which is giving me a deprecation warning because it uses "Assertion.AssertEquals": warning CS0618: 'NUnit.Framework.Assertion' is obsolete: 'Use Assert class instead' However, I can't see the obvious method in the Assert class that I should be using instead? AssertEquals takes two objects and a messa...

Populating DropDownList inside Repeater not working

I'm trying to populate a dropdown list inside a repeater, but I'm not being very successful. I'm probably using the wrong EventArgs e. Here's my aspx code: <asp:Repeater runat="server" id="criteriaScore"> <HeaderTemplate> <ul> <li class="header"><span class="item">Kriterie</spa...

What is a good and USEFUL project to code to learn WCF?

I like my learning projects to also be useful. If not to me then to somebody around me. What are some good projects I could code using WCF (to learn it) that I will be able to put to use for myself, or for someone or some organization I may know? What I am not interested in tutorials, or books on how to learn it. Thanks. ...

Immutable arrays in .net (c#): Reasonable approach?

You know probably the following problem: You want to share a collection between two objects A and B (or similarly want to expose a collection by a property) and ... well, you realize that this is actually not a good idea since both A and B can then modify the collection and blah blah armageddon now ... But often you realize that you don...

C# - Map Network drive from Web Service

We are working on a web service that has to run a 3rd party process that interacts with a mapped network drive. So we have to map this drive programmatically from the web service. I have already wrapped up WNetAddConnection2, etc. in a nicer class for another project, so I threw the code right in. Our web service is running under Ulti...

Can I read AssemblyFile information in Inno Setup

I would like to read these three values from my application.exe in my Inno Setup script. [assembly: AssemblyCompany("My Company")] [assembly: AssemblyProduct("My Great Application")] [assembly: AssemblyFileVersion("9.3.2")] Does anyone know how this might be accomplished? I know I can get the last one using GetFileVersion("path/to/gr...

Implement data rollback in existing CRUD app

I have an existing CRUD app that I have been tasked with implementing "tomb stoning". I need a way to allow a user to roll a given page of data back to the previous state. Say I have First Name, Last Name, and Social Security Number on a page in this app. User A updates the Last Name field. Later, User B notices that the New Last Nam...

.NET LDAP paths utilities (C#)

Is there a .NET library for LDAP paths manipulations? I would like to have something equivalent to System.IO.Path, allowing e.g. to do something like string ou1 = LDAPPath.Combine("OU=users","DC=x,DC=y"); string ou2 = LDAPPath.Parent("CN=someone,OU=users,DC=x,DC=y"); Otherwise, what's the common way to deal with LDAP distinguished nam...

.net lucene Multifield search

I have created a index as Document doc = new Document(); doc.Add(new Field("SearchKey", (item.FullTextColumn ?? item.Code), Field.Store.NO, Field.Index.TOKENIZED)); doc.Add(new Field("Type", item.Type.ToString(), Field.Store.YES, Field.Index.TOKENIZED)); doc.Add(new Field("Name", item.Name, Field.Store.YES, Fiel...

C# - Process.Start() - "The trust relationship between this workstation and the primary domain failed"

Hi Guys I have an application that, when run, does the following: Check current user is MicaUser Start Application under MicaUser using Process.Start() Exit This works fine on my Vista Dev machine, but when i try to run it under a restricted account in XP, i get the following error: "The trust relationship between this workstation a...

how to add event listener via fluent nhibernate?

I want to add an event listener (IPreUpdateEventListener) to add NH but I can't seem to find an example when using a fluent configuration. I want to be able to add the listener when I create the session factory, e.g. when the following code is execute. _sessionFactory = Fluently.Configure() .Database(MsSqlConfigura...

How to retrieve new row data from INSERT using Oracle DataAccess with Powershell?

I am using Oracle.DataAccess.Client inside Powershell. What I need to do is INSERT a new row of data, then retrieve the auto-generated ID field of the newly-created row for another INSERT command, immediately following. What is the best way to do this? I am pretty new to SQL and Oracle. Here is some of my code: $conn = "My Connection St...

Not able to set SelectedValue for DropDownList

This is a followup from http://stackoverflow.com/questions/1432790/populating-dropdownlist-inside-repeater-not-working. I'm adding a dropdownlist inside a repeater. Now I need to set the selected value, but that easier said than done... Here is my code: protected void criteriaScore_ItemDataBound(object sender, RepeaterItemEventArg...

Why doesn't .Net have a Set data structure?

One of my biggest issues dealing with a move from Java to .Net is the fact that there isn't a Set interface in .Net. I know there are libraries I could go and download but what is the reason for not having it built in? There are Maps (Dictionary) and Lists but why not a Set? Edit: I should clarify that not everyone uses .Net 3.5 yet -- ...

DataGridView not updating when bound items are changed?

I have a DataGridView which I am binding like so: companies = new BindingList<Company>(PersistenceManager.Instance.RetrieveAll<Company>(SessionAction.BeginAndEnd)); bindingSource.DataSource = companies; potentialInvestorDataGridView.DataBindings.Add("DataSource", bindingSource, "PotentialInvestors"); The problem is when I add to the P...

Best way to check if System.Type is a descendant of a given class

Consider the following code: public class A { } public class B : A { } public class C : B { } class D { public static bool IsDescendantOf(this System.Type thisType, System.Type thatType) { /// ??? } void Main() { A cValue = new C(); C.GetType().IsDescendantOf(cValue.GetT...

C# - reading text off of an existing process

We are having to read text off of an existing VB6 application. So we use the methods FindWindow, GetWindowText, and EnumChildWindows out of kernel32 and can enumerate and read the displayed text in this process. We are able to read 90% of the text with our method, but there is a specific control (or box) in general that we cannot read....