From: mynamehere@comcast.net   
      
   "Maarten" wrote in message   
   news:418ce84f$0$4340$ba620e4c@news.skynet.be...   
   | hi all   
   |   
   | why should I use a usercontrol for ?   
   | does it have some advantages?   
   |   
   | thanks Maarten   
   |   
      
   A good way to start is to make a user control that contains one regular   
   control, so you can define some special behavior for it. Try this in a   
   new project:   
      
   1. Click on Project menu, Add User Control   
   2. On the user control, place one text box.   
   3. Add the code below. Close the user control window.   
   4. On Form1, place 2 or 3 of your new controls. Your control will appear   
   last on the toolbox, and you can place them just like other controls.   
   5. Run the program, and type stuff in the text boxes.   
   6. Note that you can now use this control as many times as you like on   
   different forms, without having to duplicate the color change code.   
      
   ' User control code   
      
   Private Sub Text1_Change()   
    If InStr(1, Text1.Text, "red", vbTextCompare) Then   
    Text1.ForeColor = vbRed   
    Else   
    Text1.ForeColor = vbBlack   
    End If   
   End Sub   
      
   Private Sub UserControl_Resize()   
    With UserControl   
    Text1.Move .ScaleLeft, .ScaleTop, .ScaleWidth, .ScaleHeight   
    End With   
   End Sub   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|