L
Lucas
Hello,
I have an MDI Parent that contains an MDI Child form. That child form
has a textbox that accepts the enter key and loads data into the form
accordingly. There is a button on this form that opens another MDI
Child using this method:
Private Sub btnPolGenRate_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnPolGenRate.Click,
btnSTRate.Click
If PolicyNumber = 0 Then Exit Sub
Dim frmRating As New frmRatingMain
With frmRating
.PolicyNumber = PolicyNumber
.tabRating.SelectedTab = .tpgProjection
End With
Call ShowMDIChild(Me.MdiParent, frmRating)
End Sub
Public Sub ShowMDIChild(ByVal frmParent As frmWCMain, ByVal
frmChild As Form)
On Error Resume Next
frmChild.MdiParent = frmParent
If frmParent.MdiChildren.Length > frmParent.ChildCount Then
MsgBox("Cannot display anymore windows. Please close some
windows and try again.", MsgBoxStyle.Exclamation, "Attention !!")
Else
frmChild.Show()
End If
End Sub
Upon showing this second MDI child and closing it, the textbox on the
original MDI child will no longer fire the Key Press event when
pressing enter. Any other keys will fire the event. The Key Press
event code is as follows:
Private Sub txtPolNo_KeyPress(ByVal sender As System.Object, ByVal e
As System.Windows.Forms.KeyPressEventArgs) Handles
txtProjPolNo.KeyPress, txtCCPolNo.KeyPress, txtRateExPolNo.KeyPress,
txtCompPol.KeyPress, txtSucPolno.KeyPress
Dim txtBox As TextBox = CType(sender, TextBox)
If IsNumeric(txtBox.Text.Trim) = False Then Exit Sub 'will handle
blanks also
If e.KeyChar = ENTER_KEY Then
If ValidatePolicyNumber(CLng(txtBox.Text.Trim)) = False Then Exit Sub
e.Handled = True
PolicyNumber = CLng(txtBox.Text.Trim)
Call LoadRoutine()
End If
End Sub
I am stumped, so any help would be greatly appreciated. Thank you all
in advance.
Lucas
I have an MDI Parent that contains an MDI Child form. That child form
has a textbox that accepts the enter key and loads data into the form
accordingly. There is a button on this form that opens another MDI
Child using this method:
Private Sub btnPolGenRate_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnPolGenRate.Click,
btnSTRate.Click
If PolicyNumber = 0 Then Exit Sub
Dim frmRating As New frmRatingMain
With frmRating
.PolicyNumber = PolicyNumber
.tabRating.SelectedTab = .tpgProjection
End With
Call ShowMDIChild(Me.MdiParent, frmRating)
End Sub
Public Sub ShowMDIChild(ByVal frmParent As frmWCMain, ByVal
frmChild As Form)
On Error Resume Next
frmChild.MdiParent = frmParent
If frmParent.MdiChildren.Length > frmParent.ChildCount Then
MsgBox("Cannot display anymore windows. Please close some
windows and try again.", MsgBoxStyle.Exclamation, "Attention !!")
Else
frmChild.Show()
End If
End Sub
Upon showing this second MDI child and closing it, the textbox on the
original MDI child will no longer fire the Key Press event when
pressing enter. Any other keys will fire the event. The Key Press
event code is as follows:
Private Sub txtPolNo_KeyPress(ByVal sender As System.Object, ByVal e
As System.Windows.Forms.KeyPressEventArgs) Handles
txtProjPolNo.KeyPress, txtCCPolNo.KeyPress, txtRateExPolNo.KeyPress,
txtCompPol.KeyPress, txtSucPolno.KeyPress
Dim txtBox As TextBox = CType(sender, TextBox)
If IsNumeric(txtBox.Text.Trim) = False Then Exit Sub 'will handle
blanks also
If e.KeyChar = ENTER_KEY Then
If ValidatePolicyNumber(CLng(txtBox.Text.Trim)) = False Then Exit Sub
e.Handled = True
PolicyNumber = CLng(txtBox.Text.Trim)
Call LoadRoutine()
End If
End Sub
I am stumped, so any help would be greatly appreciated. Thank you all
in advance.
Lucas