Question Override Controls Property

prav_roy

Well-known member
Joined
Sep 10, 2005
Messages
70
Location
Mumbai
Programming Experience
1-3
Hi,
I have used NumericUpdown Control in my project, control appears in all most all forms, you may be aware of the fact that minimu and maximum value of numericupdown is 0 and 100 resp by default.
Now let me come to the problem i want to override this propert of Numericupdown to set min and max value, my code looks like

Public Class NumericControl
Inherits NumericUpDown

Public Overloads Property Minimum() As String
Get
Return MyBase.Minimum = 0
End Get
Set(ByVal value As String)
MyBase.Minimum = value

End Set
End Property
Public Overloads Property Maximum()
Get
Return MyBase.Maximum = 10000
End Get
Set(ByVal value)
MyBase.Maximum = value
End Set
End Property
End Class


But it doesnt work
any suggestion from your side

Regards

Praveen
 
Hello.

VB.NET:
Return MyBase.Minimum = 0
This is nonsense! If this would return something than it's a boolean!
If you already override the NumericUpDown-Control, use New() to set the desired values.

VB.NET:
Public Sub New()
      Me.Minimum = 0
      Me.Maximum = 1000
End Sub

Bobby
 
hi again

Public Class NumericUpDowns
Inherits NumericUpDown
Public Sub New()
InitializeComponent()
Me.Minimum = 0
Me.Maximum = 1000
End Sub
End Class

does this correct syntex

Regards
Praveen
 
Sounds correct, yes.
The only think you might be aware of, is that it's possible that the Maximum gets still overwritten 'cause it's getting set within the yourForm.Designer.vb.

Bobby
 
Back
Top