Problems changing properties on a control using the controls name
        Posted  
        
            by carny666
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by carny666
        
        
        
        Published on 2010-06-16T13:28:53Z
        Indexed on 
            2010/06/16
            13:32 UTC
        
        
        Read the original article
        Hit count: 221
        
c#
This should work.. I think..
string ctrlName = "btnSomeButton" + someIndexValue;
this.Controls[ctrlName].Text = "Some value";
I get 'Object reference not set to an instance of an object.', the control does exist on the form. I've tried casting it.
© Stack Overflow or respective owner