Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
C

Chris Richner

@Chris Richner
About
Posts
102
Topics
55
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Excel 2007 automation on top of a Windows Server 2008 x64 [modified]
    C Chris Richner

    I’m well aware of the Microsoft support base article stating that it’s not supported to automate office products UI less. It seems that Windows Server 2008 and Excel 2007 enforce the given statement. I’m running the following code in a NT Service (Local System account) OnStart method. All it does is Excel automation the way it’s working when you run the same code in a Console Application. The provided code has two parts. The first part launches Excel, creates a new work book and saves it to the given filename. The second part launches a new instance of Excel and opens the given file. The open operation ends in this exception: Service cannot be started. System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Office Excel cannot access the file 'c:\temp\test.xls'. There are several possible reasons: • The file name or path does not exist. • The file is being used by another program. • The workbook you are trying to save has the same name as a currently open workbook. Why was the automated excel able to launch and write files to disk but fails when it’s asked “just “ to open an existing file?

    System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
    // launch excel and create/save a new work book
    Microsoft.Office.Interop.Excel.ApplicationClass excel = new Microsoft.Office.Interop.Excel.ApplicationClass();
    excel.UserLibraryPath, excel.Interactive));
    //
    string filename = "c:\\temp\\test.xls";
    if(System.IO.File.Exists(filename)) System.IO.File.Delete(filename);
    //
    excel.Workbooks.Add(System.Reflection.Missing.Value);
    excel.Save(filename);
    excel.Quit();
    excel = null;
    // lauch new instance of excel and open saved file
    excel = new Microsoft.Office.Interop.Excel.ApplicationClass();
    try
    {
    Microsoft.Office.Interop.Excel.Workbook book = excel.Workbooks.Open(filename,
    System.Reflection.Missing.Value,
    System.Reflection.Missing.Value,
    System.Reflection.Missing.Value,
    System.Reflection.Missing.Value,
    System.Reflection.Missing.Value,
    true,
    System.Reflection.Missing.Value,
    System.Reflection.Missing.Value,
    false,
    false,

    COM css com design sysadmin windows-admin

  • New layout problem [modified]
    C Chris Richner

    same problem with IE 8 Beta 2

    Chris Richner, raccoom.net

    Site Bugs / Suggestions question html com tools help

  • Suggestion : Clear All Bookmarks function
    C Chris Richner

    Hi there, Sounds strange I know. But after after years ( my sixth ) and severals version of .net I've got a lot of bookmarks. I decided to start over from scratch and would like to delete all of my bookmarks. Now this looks like a never ending story and pane in the arse to delete each and every bookmark by its Delete link. Do I miss something or do I just miss a "Clear all" function?

    Chris Richner, raccoom.net

    Site Bugs / Suggestions csharp question announcement

  • Delay Signed WF Assemblies -> error 348: Compilation failed. Unable to load one or more of .....
    C Chris Richner

    Hi, We're facing an issue moving to delay signed assemblies on our dev boxes. Everything works like a charm except the compilation of a workflow project which uses activites nested in a referenced delay signed assembly of our own fails with error: error 348: Compilation failed. Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. I think the issues is somehow related to this forum thread, that's why I kick in here with this question. If I regular sign the referenced activity assembly everthing compiles without any problems on a 32bit and on a 64bit machine a like. Any hints about this issue? Isn't it a supported scenario to delay sign workflow activity component model assemblies?

    Chris Richner, raccoom.net

    WCF and WF help question csharp workspace

  • WCF DataContract: Dictionary<string, object> Types must use StringComparer.OrdinalIgnoreCase
    C Chris Richner

    I must use StringComparer.OrdinalIgnoreCase instead of the default GenericComparer<> to compare the keys in the dictionaries. It's no problem to create and work service side with such Dictionaries because I have full control over creation of it. But when the generated client proxy communicates with the service the creation happens behalf of the deserializer ( ? ) and it's using the default GenericComparer<> instead of the StringComparer.OrdinalIgnoreCase. On one hand it seems that there is no way to change the Comparer after the dictionary was created because it is a constructor argument and on the other hand it makes no sense at all because all wsdl based generated proxies must have knowledge about the special comparer type as well. Is there any way to define the Comparer Type for DataContract Collection? read the full story here http://forums.microsoft.com/forums/ShowPost.aspx?PostID=3263018&SiteID=1[^] Thanks

    Chris Richner, raccoom.net

    WCF and WF csharp wcf com help question

  • What about a codeproject service web API
    C Chris Richner

    where anybody could consume serveral services to access such data? I guess a lot of little useful gadget would be written. Maybe it's enough to provide rss feeds for each author, providing the articles grouped by the categories etc.. so everyone could subscribe to it's favourite writer... how about that?

    Chris Richner, raccoom.net

    Site Bugs / Suggestions csharp json question

  • ComponentModel vs ObjectModel namespace
    C Chris Richner

    Would you rather put your interfaces and basic stuff in a namespace called ComponentModel or ObjectModel? Any other namespaces that suits for that need?

    myMsg.BehindDaKeys = "Chris Richner";

    .NET (Core and Framework) visual-studio question

  • How to run custom code when List.Add or List.Remove is running
    C Chris Richner

    Thanks guys, This way round things look like they did in System.Collections.xx namespace. Seems like I just got the wrong base class ;(

    myMsg.BehindDaKeys = "Chris Richner";

    C# question csharp design tutorial

  • How to run custom code when List.Add or List.Remove is running
    C Chris Richner

    Hi, Before generics I used something like this to connect childs with parent classes

    interface IMyItem
    {
    CollectionOwner Owner{get;set;}
    }
    class MyCollection : System.Collections.CollectionBase
    {
    // ctor
    public MyCollection(CollectionOwner owner)
    {
    _owner = owner;
    }
    // internal interface
    protected override OnAdd(object item)
    {
    if(item is IMyItem) ((IMyItem)item).Owner = _owner;
    }
    }

    this way one was able to add items to a owner class owner.Items.Add(new Item()) and the owner had the item instance in his list while the item had a reference to his owner, which made a call like item.Remove() possible instead of calling owner.Items.Remove(item) Now, .net 2.0 introduced generics, way cool. But how do I implement this behaviour with generics? There is no overrideable method instead of using the brute force method with new

    class MyCollection<T> : List<T>
    where T : IMyItem

    {
    // ctor
    MyCollection(CollectionOwner owner)
    {
    _owner = owner;
    }
    new public void Add(T item)
    {
    item.Owner = _owner;
    base.Add(item);
    }
    }

    this way if one is casting MyCollection back to List<> my custom add method isn't run. bad design how can I extend generic collection base classes with such logic to do some extra work on each add or remove?

    myMsg.BehindDaKeys = "Chris Richner";

    C# question csharp design tutorial

  • How to implement a singleton in c# generic classes
    C Chris Richner

    Hi, Thanks for your ansswers, don't get confused about the singelton pattern. I know that I didn't presented the whole code here that the singleton pattern would make sense and run. It isn't that much about the singleton pattern, just about accessing a static field on a generic class. It seems to me that the big feature I really like about generics is going to make me some troubles accessing a single running instance of class within the application code. Maybe this is just a indicator that the app design isn't that good yet. Thanks any way

    myMsg.BehindDaKeys = "Chris Richner";

    C# csharp linux tutorial question

  • How to implement a singleton in c# generic classes
    C Chris Richner

    Hi Jun Du, One have to know the SomeConcretClassType to access the class type to get the Instance property. What happens now if the class instance was made by

    new ShellApplicationBase();

    but one access the singleton inside the application as

    ShellApplicationBase.Instance.DoNothingAndWaitInfite();

    as far as I could see this is not the same but it would work, right? There must be a way to retrieve this Instance property on this generic class without giving types to access just the class type, am I wrong?

    myMsg.BehindDaKeys = "Chris Richner";

    C# csharp linux tutorial question

  • How to implement a singleton in c# generic classes
    C Chris Richner

    Hi, My class looks like

    public abstract class ShellApplicationBase<TModule, TModuleLoader> : BaseNet.Icarus.Shell.Interfaces.IShellApplication
    {
    }

    Every class in my app should now be able to access the shell class. Therefore I wanted to implement a singleton where one could access Shell.Instance.DoNothingAndWaitInfite(); to do so i did

    static IShellApplication _instance;
    public IShellApplication Instance
    {
    get
    {
    return _instance;
    }
    }

    so far so good, there is a static public IShellApplication Property on my shell class. Now one would have the idea to access this singelton inside the app

    ShellApplicationBase<???>.Instance.DoNothingAndWaitInfite();

    How can one access the generic class .Instance without knowing the concrete Types ( ??? ) that have been used to make a new instance of the generic class? I just like to access this shell class from everywhere in my app, any ideas?

    myMsg.BehindDaKeys = "Chris Richner";

    C# csharp linux tutorial question

  • Microsoft Enterprise Library
    C Chris Richner

    of course ;) it should just serve as an example... any way.. would be a handy thing to be able to get all cat names out of the compiled assembly... forget about the customer scenario :)

    myMsg.BehindDaKeys = "Chris Richner";

    .NET (Core and Framework) csharp help question

  • Microsoft Enterprise Library
    C Chris Richner

    Hi Mark, The goal should be to retrieve all those defined names from a compiled assembly. Nobody can remember all defined names after the assembly is released, right? Imagine the defined config file get lost. In this case one have to watch in the code (MyClass.Getxx()) to make sure all defined names are configured well again. Not really handy if one is out there by a customer trying to setup the whole thing again. That's the reason way I like this attribute based solution, one could write a small tool that uses reflection to fetch all names out of the assemblies. To generate a config file containing all defined names is just a nice to have thing, of course. Thanks for your answer.

    myMsg.BehindDaKeys = "Chris Richner";

    .NET (Core and Framework) csharp help question

  • Microsoft Enterprise Library
    C Chris Richner

    Hi, I really think that this lib is a good base for an app framework. The only problem I personally see is that you have to provide exception policiy and logging category names by string literals. One maybe tend to use string constants, better than nothing. But .net offers reflection, so there should be a way to get all those defined policiy and logging category names at the end of the day out of an assembly, right? This makes it type safe for coding and easy to config for admins as well. Possible scenario could be to generate app.config file with each policiy and loggin category name included for a default config. Did somebody write some attribute based code to use the Microsoft Enterprise Library features?

    myMsg.BehindDaKeys = "Chris Richner";

    .NET (Core and Framework) csharp help question

  • VS.NET 2003 & Source Safe 6d - SCC bound WebService project fails to open
    C Chris Richner

    Almost every time I try to load my source safe bound solution containing a webservice project located on my local IIS I end up with a dialog box that says that the webservice project can't be found. No matter what you click or do you end up loading the solution without the webservice project. The trick is that you have to remove the webproject from the loaded solution and then add it again, this way round it works. :mad: The webservice project is located on the project directory structure, it's not under wwwroot... did anybody face the same problem and found a solution to this anyoing problem? myMsg.BehindDaKeys = "Jerry Maguire";

    C# csharp visual-studio windows-admin help question

  • BindingContext - Combobox issue
    C Chris Richner

    Introduction

    I've got a combobox on my form which is bound to a complex data source (IList).

    myCombobox.DataSource = myList;
    myCombobox.DisplayMember = "LastName";
    myCombobox.ValueMember = "person_id";

    The combobox itself is bound to a business object

    myCombobox.DataBindings.Add("SelectedValue", myBusinessObjectInstance, "person_id");

    So far so good. My combobox is filled with the provided Items and when I select an item inside the combobox the value get's updated in my myBusinessObjectInstance as expected.

    Problem

    As far as I understand the BindingContext class it holds all bindings (controls) bound to the same data source instance, in my case myBusinessObjectInstance. But when I ask the form for the BindingContext attached to myBusinessObjectInstance the combobox binding is missing. What do I miss? myMsg.BehindDaKeys = "Jerry Maguire";

    .NET (Core and Framework) help wpf wcf business question

  • Forcing VS.NET 2005 to use .NET 1.1 framework.
    C Chris Richner

    This is a project option and only affects the target run time version but does NOT affect Visual Studio itself. myMsg.BehindDaKeys = "Jerry Maguire";

    .NET (Core and Framework) csharp visual-studio question

  • access frm inside thread to form controls
    C Chris Richner

    Hi, If you running against .net 2.0 use the BackgroundWorker component to avoid this issue. Otherwise crawl trough the cp articles related to threading GUI issues. myMsg.BehindDaKeys = "Jerry Maguire";

    .NET (Core and Framework) com help question

  • TextBox.AutoComplete .net 2.0
    C Chris Richner

    Hi, I would like to use the new AutoComplete feature supported in .net 2.0. I use it with a custom source, means I build my own suggestion string list for autocompletion mechanism. The goal should be that the textbox remembers all text that passed the validation mechanism for future use within the application session. Just in case the user has to reenter the same text again and again. If I try to add the validted text to the custom source in an event like Validated or Leave, I can't tab out of the control. I have to hit the tab key twice to move out. It seems like I break the autocomplete mechanism by adding strings during the tab out process. Have anybody found a way to use the AutoComplete feature in .net 2.0 in that manner I described above without any tab key issues? Thanks myMsg.BehindDaKeys = "Jerry Maguire"; -- modified at 9:38 Thursday 9th March, 2006

    .NET (Core and Framework) csharp question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups