Saturday, January 16, 2010

Building up a control with vb.net?

I want to be able to do the following:


Me.lbl_ += ctl.ID.Substring(2) + ';.text = '; + dr(';ErrMess';))


Me.lbl_ += ctl.ID.Substring(2) - this would build up the name of the label control.


';.text = '; + dr(';ErrMess';)) - this would add the required text to the control.





is there any way of buildind up a control and then adding a value to it.Building up a control with vb.net?
It looks like your code is correct, I'm not entirely sure what you want to do or what you are doing wrong. It seems your second question concerns adding values to controls; you can inherit controls and add additional functionality to them. For example:





public class MyTextBox inherits TextBox





public property Value


get


return myValue


end get





set


myValue = value


end set





end property





dim myValue as String





end class





* If a control is part of your project, or if you add a reference to a project or assembly that contains controls, when you compile the project, you'll notice that your custom classes that represent controls are added to the toolbox. You do have to compile the project once to get them in the toolbox.





If you need more help, you can email me, but try to be a little clearer ;)
  • topical cream
  • No comments:

    Post a Comment