VERSION 5.00 Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} ch3_10_inputBox Caption = "Curve Input Box" ClientHeight = 3600 ClientLeft = 45 ClientTop = 345 ClientWidth = 5235 OleObjectBlob = "ch3_10_inputBox.frx":0000 StartUpPosition = 1 'CenterOwner End Attribute VB_Name = "ch3_10_inputBox" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub btnAdd_Click() 'If Line is selected If rbnLine Then 'check if the inputs are numbers If Not checkNumeric(txtPointX) Then Exit Sub If Not checkNumeric(txtPointY) Then Exit Sub If Not checkNumeric(txtSlope) Then Exit Sub 'If QuadraticCurve is selected ElseIf rbnQuadraticCurve Then 'check if the inputs are numbers If Not checkNumeric(txtA) Then Exit Sub If Not checkNumeric(txtB) Then Exit Sub If Not checkNumeric(txtC) Then Exit Sub End If 'Pass back control to main procedure Hide End Sub Private Sub btnFinish_Click() 'Set all textboxes to empty string txtPointX = "" txtPointY = "" txtSlope = "" txtA = "" txtB = "" txtC = "" 'Pass back control Hide End Sub Private Sub rbnLine_Click() 'Set Line textbox active txtPointX.Enabled = True txtPointY.Enabled = True txtSlope.Enabled = True txtPointX.BackColor = &H80000005 txtPointY.BackColor = &H80000005 txtSlope.BackColor = &H80000005 'Set QuadraticCurve textbox inactive txtA.Enabled = False txtB.Enabled = False txtC.Enabled = False txtA.BackColor = &HE0E0E0 txtB.BackColor = &HE0E0E0 txtC.BackColor = &HE0E0E0 End Sub Private Sub rbnQuadraticCurve_Click() 'Set Line textbox inactive txtPointX.Enabled = False txtPointY.Enabled = False txtSlope.Enabled = False txtPointX.BackColor = &HE0E0E0 txtPointY.BackColor = &HE0E0E0 txtSlope.BackColor = &HE0E0E0 'Set QuadraticCurve textbox active txtA.Enabled = True txtB.Enabled = True txtC.Enabled = True txtA.BackColor = &H80000005 txtB.BackColor = &H80000005 txtC.BackColor = &H80000005 End Sub Private Sub txtA_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) setTextBoxFocus txtA End Sub Private Sub txtB_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) setTextBoxFocus txtB End Sub Private Sub txtC_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) setTextBoxFocus txtC End Sub Private Sub txtPointX_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) setTextBoxFocus txtPointX End Sub Private Sub txtPointY_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) setTextBoxFocus txtPointY End Sub Private Sub txtSlope_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) setTextBoxFocus txtSlope End Sub Private Function checkNumeric(ctrl As Control) As Boolean checkNumeric = IsNumeric(ctrl) If Not checkNumeric Then MsgBox "Input incorrect! Must input a number!", vbExclamation, "Input incorrect" setTextBoxFocus ctrl End If End Function Private Sub setTextBoxFocus(ctrl As Control) ctrl.SelStart = 0 ctrl.SelLength = Len(ctrl) ctrl.setFocus End Sub