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
M

MichCl

@MichCl
About
Posts
113
Topics
26
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Referencing dll locations
    M MichCl

    That's excellent! We've been having these problems (referencing wrong dll) for a while now! This will solve that!

    C# announcement csharp visual-studio debugging help

  • Event/Delegate for progress bar issue
    M MichCl

    Guess what???! I cleaned all of my classes, detached and re-attached references, and it's working now. I guess I had the delegates/events and the interfaces set up correctly after all!!!! I was stepping through and noticed an exception was being thrown so I wasn't getting to my event setup (+/-), so that's why it was null and missing updating the progressBar. :) Thanks for the help!!

    C# help visual-studio wpf com announcement

  • Event/Delegate for progress bar issue
    M MichCl

    Did you see the changes I made to the original post?

    C# help visual-studio wpf com announcement

  • Event/Delegate for progress bar issue
    M MichCl

    Thanks! I updated the original post with vs project names.

    C# help visual-studio wpf com announcement

  • How to update progressBar from another class
    M MichCl

    @jibesh - I added an interface (see my recent question), and my event is null when I try to update my progress bar. I know you have a good idea about events and interfaces. If you could take a look at my newly posted question(Thursday post maybe), I'd appreciate it. Thanks!

    C# csharp c++ database visual-studio com

  • Event/Delegate for progress bar issue
    M MichCl

    Like I said. There are two different factories. One for comm, one for crx. I get two different things from them. The fact that I don't have a check for CR5 or CR6, is because my cr factory returns an instance of iCR that is an instance of either cr5 or cr6. When I make a call from my instance of icr that is returned, it will automatically go to the implementation of cr5 or cr6, whichever I instantiated in the factory. I realize the compiler doesn't care about the delegate location and usage, but I do. The structure/fix that you are suggesting doesn't translate even slightly to my code, which is in separate vs projects. I can't put my delegate where you have it, so it's not a fix for my problem. Thanks for the help!

    C# help visual-studio wpf com announcement

  • Event/Delegate for progress bar issue
    M MichCl

    Yes, but I have two factories. One for CR5 interface and one for CRComm interface. It may not be obvious from what I posted, but they have very different uses. Generic needs to use CR5 for writes. CR5Comm is used all over the place and definitely isn't the same/can't be condensed into one with CR5. You're changing the use of everything too much for it to be helpful. Maybe we need to go back to the original VS project definitions of everything? I know it's difficult, but it's like that for a reason. Even where you put the delegate doesn't translate to anywhere in my code.

    C# help visual-studio wpf com announcement

  • Event/Delegate for progress bar issue
    M MichCl

    Your definition and use of iCRComm is what my iCR interface is. It's still not doing what my iCRComm does. Thanks for helping!!

    C# help visual-studio wpf com announcement

  • Event/Delegate for progress bar issue
    M MichCl

    Can CR5 inherit from both iCR and iCRComm?

    C# help visual-studio wpf com announcement

  • Event/Delegate for progress bar issue
    M MichCl

    It seems like the place you're putting the delegate won't work for me since you have it all in one program and I don't. I see that it works, though.

    C# help visual-studio wpf com announcement

  • Event/Delegate for progress bar issue
    M MichCl

    Good start. The Cr5_Comm class is missing from that. Good idea for ProgressChangeHandler to lose the 2. If you don't have the iCR_Comm interface, it's like I never made my changes at all.

    C# help visual-studio wpf com announcement

  • Event/Delegate for progress bar issue
    M MichCl

    Thanks for the input, Eddy. I guess it's a good idea to try and put it in a simple console app. It might be crucial that I'm jumping through separate vs projects etc, so I left it as-is. I'm not sure why CR5 has a main. It's mostly just a dll and not a form, unlike a lot of my other classes. cr is an iCR type. It looks like this in the factory:

    public iCR GetCR(CRType type, int slaveIndex)
    {
    iCR cr = null;
    switch (type)
    {
    case CRType.CR5:
    cr = new CR5_new.CR5(slaveIndex);
    break;
    case CRType.CR6:
    cr = new CR6.CR6(slaveIndex);
    break;
    default:
    throw new ArgumentException(string.Format("A CR of type {0} cannot be found", Enum.GetName(typeof(CRType), type)));
    }
    return cr;
    }

    C# help visual-studio wpf com announcement

  • Event/Delegate for progress bar issue
    M MichCl

    I'm trying to add an interface, but it's causing havoc with my ProgressBar update events (My progress bar event is null so my progress bar never gets updated). I have the following older link about it: [^] The progress bar works where it doesn't use events in Generic, but it's not working where I'm using the events in CR5_new and CR5_Comm. As you can see below, when I get to RaiseProgressChange in my CR5_new class, the event is null. I can't figure out why it's null. I'm not very good with events, and throwing in the interface (the iCR_Comm interface is new) doesn't help, since I'm not very good at interfaces either. I removed unrelated code, so hopefully this post isn't missing important definitions. I realize that this doesn't look familiar to you and is a lot of info, but any help would be appreciated. If anyone is mean, I'm not going to upvote that comment. There are very specific project related reasons that these are all separate vs projects. (re-use, multiple CRx's, multiple CRx_comm's, and numerous dynamic data classes that give extra control info to the Generic class.) Everything works (programming, write, read, through CR5_Comm class), so don't focus on that. It's just the events that update the progress bar that don't work. Names of classes have been changed enough that they don't give away our information, but still resemble my code. My code looks like this now (all separate vs projects): vs project: crTool frmUserForm.cs:

    using USB_Comm;
    namespace CRWriter
    {
    public partial class frmUser:Form
    {
    public frmUser(string dllSelected, TemplateHandlerApplication.Templates.TEMPL[] template, string dll, Site.Site.SITE cert0)
    {
    programDll = dllSelected;
    templateArr = template;
    itsDll = dll;
    cert = cert0;
    InitializeComponent();
    CreateSubForms(); //start here
    }
    private void CreateSubForms()
    {
    cb = new CrComm();
    int errValue = cb.FindUsbHid(ref HWndBoxID); //see how many boxes there are
    for (int i = 0; i < cb.cbInfos.Length; i++)
    {
    iCRComm cb1 = null;
    if (controls[i] == null)
    {
    CRComm_Factory.CRCommFactory factory = new CRComm_Factory.CRCommFactory();
    int type = factory

    C# help visual-studio wpf com announcement

  • Could not evaluate expression
    M MichCl

    Do you have any thoughts on why this question isn't appearing in my question list?

    C# help csharp c++ css com

  • Custom Control making main control it is placed in blank
    M MichCl

    I am redesigning my code so that what used to be a child control is now a control displayed in another control, which is placed in a form. Unfortunately, when I add the Ko portion, it makes what is displayed in my form blacnk. I'm not sure why. It looks like this: (hit edit to view properly since website seems to delete all spaces) CrMfgTool Generic Ko VS Project frmUsrFrm.cs GenericPC.cs PC.cs class in proj --------- ---------- --------- | | |GetPC | |GetPC | | | ------>| |------->| | |--------- |---------- |--------- Some of the code: CrMfgTool frmUsrFrm.cs:

    public partial class frmUser:Form
    {
    ...
    private void CreateSubForms()
    {
    this.SuspendLayout();
    ...
    GenericCrWr.GenericPC gen = new GenericCrWr.GenericPC();
    controls[i] = gen.GetPC(cb1, programDll, templateArr, itsDll, cert, i, cb1.cbInfos[i].boxID, this);
    controls[i].Dock = DockStyle.None;
    controls[i].Location = new Point(myDockLocationX[i], myDockLocationY[i]);
    ... //(it looks tiled with 3 other controls)
    }

    Generic GenericPC.cs:

    public partial class GenericPC : UserControl
    {
    //this control shows on main form (combo boxes,
    //labels, text boxes, etc)
    //ok when I comment out Ko's GetPC
    public Control GetPC(USB_Comm.Box cbInstance, string dllSelected, TemplateH.Temp.TEMPL[] template, string dll, Cert.Cert.CERT cert0, int slaveIndex, int boxID, Form theParent) //ignore theParent...not using it
    {
    ...
    _assembly = Assembly.LoadFrom(itsDll);
    _type = _assembly.GetType("CrWr.PC");
    _objectInstance = Activator.CreateInstance(_type);
    _parameters = new Object[] { cb, itsDll, templateArr, itsDll, cert, SlaveIndex, cb.cbInfos[SlaveIndex].boxID, this };
    itsControl = new Control();
    itsControl = (Control)_type.InvokeMember("GetPC", BindingFlags.Default | BindingFlags.InvokeMethod, null, _objectInstance, _parameters);
    //trying to add this to make control returned show on my form
    // correctly. Blank form appears when I do nothing with
    // itsControl returned above.
    //The following commented out line doesn't build.
    //It says "Cannot
    //ass

    C# visual-studio question

  • form closing event not going to method
    M MichCl

    I got it working!! Thanks for your help!! :) It turns out I was missing "new":

    theParent.FormClosing += new FormClosingEventHandler(this.updateLogsOnClose);

    C# com

  • form closing event not going to method
    M MichCl

    Thanks Eddy. I'm trying to figure out how to use theParent's Form to set me up with the Closing Handler. For some reason, the below code is not building. It says "System.Windows.Forms.FormClosingEventHandler is a type which is not valid in the given context". Any idea?

    public partial class GenericPC : UserControl
    {
    ...
    public FormClosingEventHandler Closing { get; set; }

    public Control GetPC(, Form theParent) //added form here
    {
    ...
    theParent.Closing += new System.Windows.Forms.FormClosingEventHandler(this.updateLogsOnClose); //change here, build issue
    ...
    }

    private void updateLogsOnClose(object sender, System.ComponentModel.CancelEventArgs e)
    {
    //thread doesn't go here when form closes
    logCountsToFile(logCountFile);
    }
    ...
    }

    C# com

  • form closing event not going to method
    M MichCl

    I changed it from FormClosing to Closing, as I changed in my code shown above, and it's still not going to my method when the form closes. Any ideas? It doesn't seem the like property for Closing gets called by anything. Do I need to set it somehow? Closing was causing a build error before I defined it. Maybe there's a system method I need to enable somewhere to get it defined by visual studio?

    C# com

  • form closing event not going to method
    M MichCl

    I'm trying to add an event handler for form closing event. I'm not very good at doing event handlers. I looked at http://stackoverflow.com/questions/7076751/how-do-i-avoid-validating-cancel-causing-app-exit-to-hang[^], among other places on the internet, but the thread is not getting to my method. It wasn't building until I added the property for FormClosing at the top. Hopefully someone here has an idea why it's not working. Thanks!

    public partial class GenericPC : UserControl
    {
    ...
    public FormClosingEventHandler Closing { get; set; }

    public Control GetPC() //this gets called
    {
    ...
    this.Closing += new System.Windows.Forms.FormClosingEventHandler(this.updateLogsOnClose);
    ...
    }

    private void updateLogsOnClose(object sender, System.ComponentModel.CancelEventArgs e)
    {
    //thread doesn't go here when form closes
    logCountsToFile(logCountFile);
    }
    ...
    }

    C# com

  • Trying to use child class method by overriding parent
    M MichCl

    I've been looking into this some more, and I think the reason flow in the parent is not seeing the overridden ValidateDynData in the child is because of the way I get flow into the parent from the child class: Is there another way to get to the parent's method without creating an instance of the parent?

    GenericPC baseInst = new GenericPC();
    return baseInst.GetPC(cbInst, dllSel, templ, dll, cert0, slaveIndex, BoxID);

    C# com 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