My First Control 
Author Message
 My First Control

Hello

I'm trying to write a simple control but I'm having difficulty
assigning values from a propert sheet.  The control is
simple , just a constituent Command button. When pressed
it will return a random number between a range of  and High
specifed in the property sheet.  I can get the Low and High
propeties to show for the control but how the heck do I
get the user modifed values.  It seems that the proprty Let
, Get fired too soon.  

Thanks in advance.

Anyone know of a good url for learning controls?
=======================================================

Option Explicit

Dim myRand As New clRandom

Dim m_Low As Long
Dim m_high As Long

Dim m_Bcolor As ColorConstants
Dim m_style As Integer

Public Property Get Low() As Long
  Low = m_Low
End Property

Public Property Let Low(vNewlow As Long)
  m_Low = vNewlow
End Property

Public Property Get High() As Long
  High = m_high
End Property

Public Property Let High(vNewhigh As Long)
??? when the developer changes the property
how do I get into m_high?????
  m_high = vNewhigh
End Property

Public Property Get BackColor() As ColorConstants
  BackColor = m_Bcolor
End Property

Public Property Let BackColor(vNewcolor As ColorConstants)
  m_Bcolor = vNewcolor
End Property

Public Property Get Style() As Integer
  Style = m_style
End Property

Public Property Let Style(vNewStyle As Integer)
   m_style = vNewStyle
End Property

Private Sub Command1_Click()
   List1.Clear
   List1.AddItem myRand.NextNumber
End Sub

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
If Ambient.UserMode = True Then
  Exit Sub
Else
  myRand.Seed Low, High, 10
End If
End Sub



Fri, 09 Aug 2002 03:00:00 GMT  
 My First Control
Look up "Public Property Get / Let / Set"

David A. Winter


Quote:
> Hello

> I'm trying to write a simple control but I'm having difficulty
> assigning values from a propert sheet.  The control is
> simple , just a constituent Command button. When pressed
> it will return a random number between a range of  and High
> specifed in the property sheet.  I can get the Low and High
> propeties to show for the control but how the heck do I
> get the user modifed values.  It seems that the proprty Let
> , Get fired too soon.

> Thanks in advance.

> Anyone know of a good url for learning controls?
> =======================================================

> Option Explicit

> Dim myRand As New clRandom

> Dim m_Low As Long
> Dim m_high As Long

> Dim m_Bcolor As ColorConstants
> Dim m_style As Integer

> Public Property Get Low() As Long
>   Low = m_Low
> End Property

> Public Property Let Low(vNewlow As Long)
>   m_Low = vNewlow
> End Property

> Public Property Get High() As Long
>   High = m_high
> End Property

> Public Property Let High(vNewhigh As Long)
> ??? when the developer changes the property
> how do I get into m_high?????
>   m_high = vNewhigh
> End Property

> Public Property Get BackColor() As ColorConstants
>   BackColor = m_Bcolor
> End Property

> Public Property Let BackColor(vNewcolor As ColorConstants)
>   m_Bcolor = vNewcolor
> End Property

> Public Property Get Style() As Integer
>   Style = m_style
> End Property

> Public Property Let Style(vNewStyle As Integer)
>    m_style = vNewStyle
> End Property

> Private Sub Command1_Click()
>    List1.Clear
>    List1.AddItem myRand.NextNumber
> End Sub

> Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
> If Ambient.UserMode = True Then
>   Exit Sub
> Else
>   myRand.Seed Low, High, 10
> End If
> End Sub



Sat, 10 Aug 2002 03:00:00 GMT  
 My First Control
On Tue, 22 Feb 2000 07:37:57 GMT, "David Winter"

Quote:

>Look up "Public Property Get / Let / Set"

Why?  Murray Thayer
Quote:
>David A. Winter



>> Hello

>> I'm trying to write a simple control but I'm having difficulty
>> assigning values from a propert sheet.  The control is
>> simple , just a constituent Command button. When pressed
>> it will return a random number between a range of  and High
>> specifed in the property sheet.  I can get the Low and High
>> propeties to show for the control but how the heck do I
>> get the user modifed values.  It seems that the proprty Let
>> , Get fired too soon.

>> Thanks in advance.

>> Anyone know of a good url for learning controls?
>> =======================================================

>> Option Explicit

>> Dim myRand As New clRandom

>> Dim m_Low As Long
>> Dim m_high As Long

>> Dim m_Bcolor As ColorConstants
>> Dim m_style As Integer

>> Public Property Get Low() As Long
>>   Low = m_Low
>> End Property

>> Public Property Let Low(vNewlow As Long)
>>   m_Low = vNewlow
>> End Property

>> Public Property Get High() As Long
>>   High = m_high
>> End Property

>> Public Property Let High(vNewhigh As Long)
>> ??? when the developer changes the property
>> how do I get into m_high?????
>>   m_high = vNewhigh
>> End Property

>> Public Property Get BackColor() As ColorConstants
>>   BackColor = m_Bcolor
>> End Property

>> Public Property Let BackColor(vNewcolor As ColorConstants)
>>   m_Bcolor = vNewcolor
>> End Property

>> Public Property Get Style() As Integer
>>   Style = m_style
>> End Property

>> Public Property Let Style(vNewStyle As Integer)
>>    m_style = vNewStyle
>> End Property

>> Private Sub Command1_Click()
>>    List1.Clear
>>    List1.AddItem myRand.NextNumber
>> End Sub

>> Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
>> If Ambient.UserMode = True Then
>>   Exit Sub
>> Else
>>   myRand.Seed Low, High, 10
>> End If
>> End Sub



Sat, 10 Aug 2002 03:00:00 GMT  
 My First Control
can't you make the High and Low properties Public so you can get and set
them?

If you are using Property Let, you should also use Property Set because
otherwise, it will make that variable read-only

Remi

Quote:

>Hello

>I'm trying to write a simple control but I'm having difficulty
>assigning values from a propert sheet.  The control is
>simple , just a constituent Command button. When pressed
>it will return a random number between a range of  and High
>specifed in the property sheet.  I can get the Low and High
>propeties to show for the control but how the heck do I
>get the user modifed values.  It seems that the proprty Let
>, Get fired too soon.

>Thanks in advance.

>Anyone know of a good url for learning controls?
>=======================================================

>Option Explicit

>Dim myRand As New clRandom

>Dim m_Low As Long
>Dim m_high As Long

>Dim m_Bcolor As ColorConstants
>Dim m_style As Integer

>Public Property Get Low() As Long
>  Low = m_Low
>End Property

>Public Property Let Low(vNewlow As Long)
>  m_Low = vNewlow
>End Property

>Public Property Get High() As Long
>  High = m_high
>End Property

>Public Property Let High(vNewhigh As Long)
>??? when the developer changes the property
>how do I get into m_high?????
>  m_high = vNewhigh
>End Property

>Public Property Get BackColor() As ColorConstants
>  BackColor = m_Bcolor
>End Property

>Public Property Let BackColor(vNewcolor As ColorConstants)
>  m_Bcolor = vNewcolor
>End Property

>Public Property Get Style() As Integer
>  Style = m_style
>End Property

>Public Property Let Style(vNewStyle As Integer)
>   m_style = vNewStyle
>End Property

>Private Sub Command1_Click()
>   List1.Clear
>   List1.AddItem myRand.NextNumber
>End Sub

>Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
>If Ambient.UserMode = True Then
>  Exit Sub
>Else
>  myRand.Seed Low, High, 10
>End If
>End Sub



Sat, 10 Aug 2002 03:00:00 GMT  
 My First Control
On Tue, 22 Feb 2000 13:59:38 -0600, "Remi Sabourin"

Quote:

>can't you make the High and Low properties Public so you can get and set
>them?

>If you are using Property Let, you should also use Property Set because
>otherwise, it will make that variable read-only

Thanks for the reply.
     The properties are public.  Property Let is used for variables,
Property Let is used for Objects.  I can Get and set the properties
it just doesn;t take effect. Let and Get or Let and Set are
used in pairs.

  I have learned more now.   The consitutent button control
is destroyed and recreated at run time  thus loosing any
design time property changes.  Looking at the next chapter
in Applemans text to see how it's done.

Thanks again

 Murray

Quote:
>Remi


>>Hello

>>I'm trying to write a simple control but I'm having difficulty
>>assigning values from a propert sheet.  The control is
>>simple , just a constituent Command button. When pressed
>>it will return a random number between a range of  and High
>>specifed in the property sheet.  I can get the Low and High
>>propeties to show for the control but how the heck do I
>>get the user modifed values.  It seems that the proprty Let
>>, Get fired too soon.

>>Thanks in advance.

>>Anyone know of a good url for learning controls?
>>=======================================================

>>Option Explicit

>>Dim myRand As New clRandom

>>Dim m_Low As Long
>>Dim m_high As Long

>>Dim m_Bcolor As ColorConstants
>>Dim m_style As Integer

>>Public Property Get Low() As Long
>>  Low = m_Low
>>End Property

>>Public Property Let Low(vNewlow As Long)
>>  m_Low = vNewlow
>>End Property

>>Public Property Get High() As Long
>>  High = m_high
>>End Property

>>Public Property Let High(vNewhigh As Long)
>>??? when the developer changes the property
>>how do I get into m_high?????
>>  m_high = vNewhigh
>>End Property

>>Public Property Get BackColor() As ColorConstants
>>  BackColor = m_Bcolor
>>End Property

>>Public Property Let BackColor(vNewcolor As ColorConstants)
>>  m_Bcolor = vNewcolor
>>End Property

>>Public Property Get Style() As Integer
>>  Style = m_style
>>End Property

>>Public Property Let Style(vNewStyle As Integer)
>>   m_style = vNewStyle
>>End Property

>>Private Sub Command1_Click()
>>   List1.Clear
>>   List1.AddItem myRand.NextNumber
>>End Sub

>>Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
>>If Ambient.UserMode = True Then
>>  Exit Sub
>>Else
>>  myRand.Seed Low, High, 10
>>End If
>>End Sub



Sat, 10 Aug 2002 03:00:00 GMT  
 My First Control



Quote:
> On Tue, 22 Feb 2000 13:59:38 -0600, "Remi Sabourin"

> >can't you make the High and Low properties Public so you can get and set
> >them?

> >If you are using Property Let, you should also use Property Set because
> >otherwise, it will make that variable read-only

> Thanks for the reply.
>      The properties are public.  Property Let is used for variables,
> Property Let is used for Objects.  I can Get and set the properties
> it just doesn;t take effect. Let and Get or Let and Set are
> used in pairs.

>   I have learned more now.   The consitutent button control
> is destroyed and recreated at run time  thus loosing any
> design time property changes.  Looking at the next chapter
> in Applemans text to see how it's done.

> Thanks again

>  Murray

> >Remi


> >>Hello

> >>I'm trying to write a simple control but I'm having difficulty
> >>assigning values from a propert sheet.  The control is
> >>simple , just a constituent Command button. When pressed
> >>it will return a random number between a range of  and High
> >>specifed in the property sheet.  I can get the Low and High
> >>propeties to show for the control but how the heck do I
> >>get the user modifed values.  It seems that the proprty Let
> >>, Get fired too soon.

Look into the probag statement. The probag is designed to hand over
properies from designtime to run-time.

--
Cees Harlaar
Change .HL to .NL to send an e-mail
Verander .HL in .NL om e-mail te sturen.



Sun, 11 Aug 2002 03:00:00 GMT  
 My First Control
never heard of probag, what is it?
Quote:

>Look into the probag statement. The probag is designed to hand over
>properies from designtime to run-time.

>--
>Cees Harlaar
>Change .HL to .NL to send an e-mail
>Verander .HL in .NL om e-mail te sturen.



Sun, 11 Aug 2002 03:00:00 GMT  
 My First Control



Quote:
> never heard of probag, what is it?


> >Look into the probag statement. The probag is designed to hand over
> >properies from designtime to run-time.

> >--
> >Cees Harlaar
> >Change .HL to .NL to send an e-mail
> >Verander .HL in .NL om e-mail te sturen.

Sorry, should be PropertyBag, from vb5 help.

A PropertyBag object holds information that is to be saved and restored
across invocations of an object.

Remarks

A PropertyBag object is passed into an object through the ReadProperties
event and the WriteProperties event in order to save and restore the state
of the object. Using the methods of the PropertyBag object, the object can
read or write properties of itself. The ReadProperty method of the
PropertyBag object is used to read a value for a property, while the
WriteProperty method of the PropertyBag object is used to write a value of a
property. The value of a property can itself be an object; in that case the
PropertyBag object will attempt to save it.



Sun, 11 Aug 2002 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. UserControl re-initializing first control in control array

2. Combo box behavior on first control in form

3. BUG: ComboBox as the first control on an UserControl

4. finding first control in a container

5. Masked Edit COM control appears only on first tab page of tab control in VB.NET

6. Visdata app corrupts first col of first row in table

7. First impressions on VB 6 database related controls?

8. how to set focus to first active control in frame

9. Please help first time ADO data control User

10. Select first item in TreeView control?

11. How do i move context to first line in richtext control

12. Q: Passing first (original) element of a control array to a SUB

 

 
Powered by phpBB® Forum Software