Click here to Skip to main content
15,886,806 members
Articles / Programming Languages / Visual Basic

Mathemathics Framework

Rate me:
Please Sign up or sign in to vote.
4.76/5 (56 votes)
16 Sep 2008CPOL6 min read 75.3K   6.2K   171  
.NET Mathematical Framework
Public Class FormSlidePopUp
    ' Inherits PropertyEditorBase

    Protected intIsCanceled As Boolean
    Protected intValue As Integer

    Public ReadOnly Property IsCanceled() As Boolean '= False
        Get
            Return intIsCanceled
        End Get
    End Property

    Public Property Value() As Integer
        Get
            Return Me.intValue
        End Get
        Set(ByVal value As Integer)
            Me.TrackBar1.Value = value
        End Set
    End Property

    Public Property Minimun() As Integer
        Get
            Return Me.TrackBar1.Minimum
        End Get
        Set(ByVal value As Integer)
            Me.TrackBar1.Minimum = value
        End Set
    End Property

    Public Property Maximum() As Integer
        Get
            Return Me.TrackBar1.Maximum
        End Get
        Set(ByVal value As Integer)
            Me.TrackBar1.Maximum = value
        End Set
    End Property

    Private Sub ButtonOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonAccept.Click
        intValue = Me.TrackBar1.Value
        intIsCanceled = False
        Me.StartClose()
    End Sub

    Private Sub ButtonCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCancel.Click
        intIsCanceled = True
        Me.StartClose()
    End Sub

    Protected Sub StartClose()
        Me.Close()
        'Me.Hide()
    End Sub

    Private Sub TextBoxValue_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBoxValue.KeyDown
        If e.KeyData = Windows.Forms.Keys.Enter Then
            If IsNumeric(Me.TextBoxValue.Text) Then
                If Me.TextBoxValue.Text <= Me.TrackBar1.Maximum AndAlso Me.TextBoxValue.Text > Me.TrackBar1.Minimum Then
                    Me.TrackBar1.Value = Me.TextBoxValue.Text
                    Exit Sub
                End If
            End If
            'si falla reestablezco l valor original
            Me.TextBoxValue.Text = Me.TrackBar1.Value
        ElseIf e.KeyData = Windows.Forms.Keys.Escape Then
            Me.TextBoxValue.Text = Me.TrackBar1.Value
        End If
    End Sub

    Private Sub TrackBar1_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TrackBar1.ValueChanged
        Me.TextBoxValue.Text = Me.TrackBar1.Value
    End Sub

End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Engineer Universidad Tecnológica Nacional
Argentina Argentina
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions