Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Re: How to do this?
Message
 
To
06/11/2002 16:07:54
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00718646
Message ID:
00719677
Views:
10
Thank you for this info.


>Ahmad,
>
>Yes, a class for each object. We have all the classes defined in one file called, for example, Controls.cs (in VB it would be Controls.vb). We have a namespace called, for example, OurCompany.WinUI.MyClasses. And in this Controls.cs file, we have defined multiple classes, one for each object.
>
>HTH,
>~~Bonnie
>
>
>
>>Ohh, no Bonnie ... I hate C# :)
>>
>>Anyhow thank you very much, I understood from your code that I have to make a Class for the Textbox then another Class for Buttons, etc... is it correct ?
>>
>>Ahmad
>>
>>
>>>Ahmad,
>>>
>>>Well, if you don't mind C# code, here's an example (sorry, I don't do VB):
>>>
>>>
>>>public class MyTextBox : System.Windows.Forms.TextBox
>>>{
>>>  private bool   m_ReadOnly = false;
>>>
>>>  // Properties
>>>  public MyReadOnly
>>>  {
>>>    get {return this.m_ReadOnly;}
>>>    set {this.m_ReadOnly = value;}
>>>  }
>>>
>>>
>>>  // Methods
>>>  public void SetProperties()
>>>  {
>>>    this.Enabled = this.m_ReadOnly;
>>>    // put any other properties you wish to set here
>>>  }
>>>}
>>>
>>>
>>>  // when using the class
>>>  private MyTextBox txtWhatever = new MyTextBox();
>>>  txtWhatever.MyReadOnly = true;
>>>  txtWhatever.SetProperties();
>>>
>>>
>>>
>>>HTH,
>>>~~Bonnie
>>>
>>>
>>>>Greate but how to do it ?!
>>>>Can you send me some samples please.
>>>>
>>>>ADSC
>>>>
>>>>>How about creating a class for these objects that has these capabilities already built-in to the class.
>>>>>
>>>>>~~Bonnie
>>>>>
>>>>>
>>>>>>Hi All,
>>>>>>I am adding some controls in the form how to do it without repeating the code, like check for the form components and check if the component type = field then do the these actions:
>>>>>>1.Change the Backcolor
>>>>>>2.object.Readonly (true / false)
>>>>>>3.Enable/disable buttons
>>>>>>
>>>>>>Code sample:
>>>>>>------------
>>>>>>Me.btnAdd.Enabled = pbbolReadOnly
>>>>>>Me.btnDelete.Enabled = pbbolReadOnly
>>>>>>
>>>>>>Me.ToolTip1.SetToolTip(btnDelete, pbstrBtnDelete)
>>>>>>Me.ToolTip1.SetToolTip(btnAdd, pbstrBtnAdd)
>>>>>>
>>>>>>Me.txtEnter.ReadOnly = pbbolReadOnly
>>>>>>Me.txtCompanyName_e.ReadOnly = pbbolReadOnly
>>>>>>
>>>>>>I would like to know if above actions can be called from a public module to avoid writing same code in every form.
>>>>>>
>>>>>>Thank you in advance
<><><><><><><><><><><><><><><><><><><><>
<><> REMEMBER,,,,KNOWLEDGE IS POWER <><>
<><><><><><><><><><><><><><><><><><><><>
Previous
Reply
Map
View

Click here to load this message in the networking platform