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
T

TheTinSoldier

@TheTinSoldier
About
Posts
23
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Using Using object disposal...
    T TheTinSoldier

    All good advice. Thanks for your time luc! :-D

    C# sharepoint question

  • Using Using object disposal...
    T TheTinSoldier

    That makes it clear! Thanks! :cool:

    C# sharepoint question

  • Using Using object disposal...
    T TheTinSoldier

    Good to know! Thanks!

    C# sharepoint question

  • Using Using object disposal...
    T TheTinSoldier

    Hi Luc. In regards to your points: 1. I need to first open the port to call the IsOpen property. I am checking if the port is in use. (not by my application). 2. It would be nice to know if it does matter, as I'll do it your way if it's the right way 3. I get the feeling (from you and others) that even though the object will be disposed it wouldn't hurt to close it first. 4. This is interesting, I'd better check that out. I think for what I'm doing it should be ok. Thanks to you and everyone for their help!

    C# sharepoint question

  • Using Using object disposal...
    T TheTinSoldier

    Thanks for your reply. I was pretty sure that was right. :-D Hey, but if an object doesn't implement IDisposable is there any point in using Using?

    C# sharepoint question

  • Using Using object disposal...
    T TheTinSoldier

    Cheers! :-D

    C# sharepoint question

  • Using Using object disposal...
    T TheTinSoldier

    Thanks for your reply. So what I'm doing is ok? i.e the serial port will be disposed in all cases when it leaves the using scope?

    C# sharepoint question

  • DataGridView && ErrorProvider
    T TheTinSoldier

    Use the ErrorText property:

    private void dgv_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
            {
                DataGridView dgv = sender as DataGridView;
    
                if (dgv.IsCurrentCellInEditMode)
                {
                     dgv.Rows[e.RowIndex].ErrorText = "You made an error";
                }
            }
    
    C# question

  • Populating data in a form
    T TheTinSoldier

    Add a Column/Link button to the row, handle the cell content click event and pass a reference to the row data to the new form:

    private void dgv_CellContentClick(object sender, DataGridViewCellEventArgs e)
            {
                DataGridView dgv = sender as DataGridView;
    
                if (dgv.Columns[e.ColumnIndex] is DataGridViewButtonColumn)
                {
                    DataForm df = new DataForm(dgv.Rows[e.RowIndex]);
                    df.ShowDialog();
                }
            }
    

    I think that should do it! -- modified at 17:33 Wednesday 18th July, 2007

    C# css question

  • Using Using object disposal...
    T TheTinSoldier

    Check this code. Two questions: 1. After opening the serial port do I need to worry about closing the port as when I return (leave the using scope) the object will automatically be disposed? 2. If the code enters the catch block will the serial port object automatically be disposed after leaving the using scope? Thanks!

            public static bool IsPortInUse(string portName)
            {
                try
                {
                    using(SerialPort sp = new SerialPort(portName))
                    {
                        sp.Open();
                        return false;
                    }
                }
                catch (UnauthorizedAccessException e)
                {
                    return true;
                }
            }
    
    C# sharepoint question

  • Updating UI/Dataset from serialport
    T TheTinSoldier

    Now that sounds like fun! I was talking to my brother over the weekend about shooting guns and I must admit that I reakon is would be a real blast - pun intended. I've shot a .22 and a slug gun when I was a kid but that's about it. I've still to check off the shotgun! It's got to be on the list of things to do at least once! Well anyway Ed, good luck and bring back some silverware!:cool:

    C# wpf wcf design xml help

  • Updating UI/Dataset from serialport
    T TheTinSoldier

    Ooops well, I guess I didn't update the default profile. I'm actually from NZ and live in NZ! So, we will have to have that beer another time! Shooting eh??! World champs! I guess you are competing, well if you dead eye with the pistola as you are with code you're bound to do well! Thanks again for you help, I really appreciated the time you spent. Good luck!

    C# wpf wcf design xml help

  • Updating UI/Dataset from serialport
    T TheTinSoldier

    Holy Bible Batman you're right!!!! Arrgggh! I didn't test your code but just tried it on my own and it works... thanks to you and your tenacious approach. And not one delegate or generic in sight! My workmate says that if your over our neck of the woods sometime (NZ) we owe you a beer. Thanks very much Ed, you've been a real help on a prob that had me completely stumped. :cool:

    C# wpf wcf design xml help

  • Updating UI/Dataset from serialport
    T TheTinSoldier

    - I didn't change the code in the buttons event handler. - I scrapped the wrapper method. - The handler is firing ok, and I've stepped through the ChangeValue method, it's doing what it should - that is, it's changing the value in the dataset. I know this because whether the DataReceived event handler or the button event calls ChangeValue the value changes and I can see it as I step though that it's been changed from the previous value. What's not updating is the Text property of the Label control that the Dataset is bound to. P.S If I trigger the ChangeValue method via the button first, the label updates fine. But if I trigger ChangeValue via your delegate method and then try the button the label doesn't update.

    C# wpf wcf design xml help

  • Updating UI/Dataset from serialport
    T TheTinSoldier

    Dang, didn't work. Does the block: // Invoke delegate normally singleCastDelegate.DynamicInvoke(arguments); Mean that it's not cross threaded? Curiously though, after I use your class then click on the button to change the value (just to see if it still works) it doesn't update the value in the label anymore... P.S I had to put a check in your code as I was getting an error if (arguments != null) <- here { if (requiredParameters != arguments.Length) .... }

    C# wpf wcf design xml help

  • Updating UI/Dataset from serialport
    T TheTinSoldier

    I have an error when I compile. This is the code I updated: private void _sp_DataReceived(object sender, SerialDataReceivedEventArgs e) { // run this method when the event fires InvocationHelper.Invoke(this.ChangeValue); } Argument '1': cannot convert from 'method group' to 'System.Delegate' P.S If you prefer to have a fiddle yourself I can send you the source. Thanks for being so helpful.

    C# wpf wcf design xml help

  • Updating UI/Dataset from serialport
    T TheTinSoldier

    Great info about the exception I'll give it a crack now, and check out your helper class. Super! :-D

    C# wpf wcf design xml help

  • Updating UI/Dataset from serialport
    T TheTinSoldier

    Thanks again Ed! I've just arrived and work this morning and it's great to see your message. Well, although I'm new to generics, I am actually using them in my project already. I'm sure I'll use them more and more as they do seem well suited to many situations, I'm just getting to the 'once you know how part'. The word delegate makes me nervous, but I'll put it with the 'once you know how' and I'm sure I'll get the hang of it. Hey, your source has been blocked, could you zip it please? Thanks heaps, you've been great. Oh, I forgot to say that under the Debug -> Exceptions, are you refering to the 'thrown' check box or the 'user-handled' check box associated with the CLR Exceptions tree? -- modified at 15:05 Wednesday 14th February, 2007

    C# wpf wcf design xml help

  • Updating UI/Dataset from serialport
    T TheTinSoldier

    Thanks Ed! Actually I saw you article today when I was searching for help. You are right it's not a form. I scanned over your article but it seemed quite complex to me (I still haven't really got my head around delegates or generics) but I'm fast running out of options so I'm going to study it and hopefully I'll find the answer.

    C# wpf wcf design xml help

  • Updating UI/Dataset from serialport
    T TheTinSoldier

    there is no this.invoke() ??!

    C# wpf wcf design xml help
  • Login

  • Don't have an account? Register

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