N3v3r G1v3 uP

take and give a point with LET and GET property

05/11/2009 12:38

design program in VB 6.0 to take and give a point with property LET and GET. the steps are

1. design from the form and the control program see pic below

2. make declaration variable and constanta on the general procedure, like below

Dim Currentcolor As String
Const black = &H80000012, red = &HFF&
Const green = &HFF00&, blue = &HF0000

3. give list of color in combobox

Private Sub Form_Load()
Combo1.AddItem "black"
Combo1.AddItem "red"
Combo1.AddItem "green"
Combo1.AddItem "blue"
End Sub

4. double click on the LET botton and type script like below

Private Sub Command1_Click()
pencolor = Combo1.text
Form3.BackColor = Currentcolor
End Sub

5. double clck on the GET botton and the fill with the script like below

Private Sub Command2_Click()
Form3.Caption = "backcolor is " & pencolor
End Sub

6. double click on the EXIT botton and write script like below

Private Sub Command3_Click()
Unload Me
End Sub

7. make property LET and GET and filled with listing like below

Property Let pencolor(colorname As String)
Select Case colorname
   Case "red"
     Currentcolor = red
   Case "green"
     Currentcolor = green
    Case "blue"
     curentcolor = blue
  Case Else
     Currentcolor = black
 End Select
End Property


Property Get pencolor() As String
Select Case curentcolor
  Case red
    pencolor = "red"
  Case green
    pencolor = "green"
  Case blue
    pencolor = "blue"
  Case Else
    pencolor = "black"
 End Select
End Property

8. and now RUN the program. take a look as we click LET botton you will see the color on the form. the color is appropriate with color we choose on the combo box.. and click GET botton to take color as showed on the caption form.

 

 

Subscribe
Back

Topic: take and give a point with LET and GET property

No comments found.

Search site

ranto© 2010 All rights reserved.