|
-
Oct 9th, 2001, 05:21 AM
#1
Thread Starter
Fanatic Member
Do you have a Property Let and Property Get for this your property?
In the Property Let you should do a PropertyChanged "name" for your property, you can then call this Property Let to change this property.
-
Oct 9th, 2001, 08:45 PM
#2
Junior Member
Yes,I do.
Thank you very much!
Maybe I didn't express my problem clearly last time.You know,if a property is defined as Enum type, in design time we can set its value by selecting from a list containing a series of fixed values through the property browser.
Otherwise the DataField property of a TextBox is different from above.Its value list is not fixed but alterative if the DataSourse is changed.Distinctly during development of the TextBox Control the DataField is not defined as Enum type.
How can I make a UserControl's property to have these design-time actions as the DataField.
Thanks again for your reply!
-
Oct 10th, 2001, 03:18 AM
#3
Thread Starter
Fanatic Member
Well ...
I have a TextBox with a DataType property, you enter a number and this is replaced with text to show what that the datatype is.
Here's the code, I'm not sure if it's the kind of thing you want or not:
VB Code:
Public Property Get DataType() As Variant
'******************************************************************************
'* Purpose : Returns the datatype of the text box contents
'*
'* Parameters : None
'*
'* Return : None
'******************************************************************************
'design time function
Select Case m_intDataType
Case vbInteger
DataType = CStr(vbInteger) & " - vbInteger"
Case vbLong
DataType = CStr(vbLong) & " - vbLong"
Case vbSingle
DataType = CStr(vbSingle) & " - vbSingle"
Case vbDouble
DataType = CStr(vbDouble) & " - vbDouble"
Case vbCurrency
DataType = CStr(vbCurrency) & " - vbCurrency"
Case vbString
DataType = CStr(vbString) & " - vbString"
Case vbObject
DataType = CStr(vbObject) & " - vbObject"
Case vbError
DataType = CStr(vbError) & " - vbError"
Case vbBoolean
DataType = CStr(vbBoolean) & " - vbBoolean"
Case vbVariant
DataType = CStr(vbVariant) & " - vbVariant"
Case vbDataObject
DataType = CStr(vbDataObject) & " - vbDataObject"
Case vbDecimal
DataType = CStr(vbDecimal) & " - vbDecimal"
Case vbByte
DataType = CStr(vbByte) & " - vbByte"
Case vbArray
DataType = CStr(vbArray) & " - vbArray"
Case Else
End Select
End Property
Public Property Let DataType(ByVal i_vntDataType As Variant)
'******************************************************************************
'* Purpose : Sets the datatype of the text box
'*
'* Parameters : i_vntDataType
'*
'* Return : None
'******************************************************************************
m_intDataType = CInt(i_vntDataType)
PropertyChanged "DataType"
AlignTextBox
End Property
-
Oct 11th, 2001, 08:43 AM
#4
Hyperactive Member
If I understood the problem, then it has no solution. Atleast to my knowledge.
Now if you want to make a property databound, thats easy. VB will automatically add the DataSource, DataMember and DataField properties to your control. But is that what you want?
Abu Haider
____________________________
100% Data Validation for the MS DataGrid Control. Plus Support for Custom and Foreign Lists, DatePicker and much more...
The DataGridEnhancer
I often point to a place where the problem has been discussed, instead of giving you the code that solves it. This is for good, may be you will understand some day...
-
Oct 11th, 2001, 08:15 PM
#5
Junior Member
No, I don't want to bind a control to a DataSource, or it is easy.
I tend to create one property which is similar with the DataField,but it does not belong to DataBinding,it is to say,in design time this property's value can be set by selecting one item from a list.although the list can be shown in the property browser,but it is not based on a Enum datatype.
It really has no solution?
Thank you very much foy the reply!
-
Oct 12th, 2001, 11:49 AM
#6
Hyperactive Member
I don't know if you would like it. But there is no way you can tell vb about the list to be displayed in the properties window.
There is a work around. Use a property page and use a combo box on it with the drop down list box style. Associate the property page with that particular property.
Now when the property page is displayed, populate the combo box depending on the selections of the other property, the user may then click on the elipsis in the property browser, then select the appropriate value from the property page.
Does it look complicated?
It took a long time for me to find this way around.
Abu Haider
____________________________
100% Data Validation for the MS DataGrid Control. Plus Support for Custom and Foreign Lists, DatePicker and much more...
The DataGridEnhancer
I often point to a place where the problem has been discussed, instead of giving you the code that solves it. This is for good, may be you will understand some day...
-
Oct 15th, 2001, 12:56 AM
#7
Junior Member
Thank you, Abu Haider, you're surely a kind one.
The way you told me is proved to be a successful solution by me before.It seems to have no more effective way to solve the problem.
thanks again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|