Vb .net vs2008 - trap input keys :evil: WHY when implementing the following code: Code: Private Sub event_KeyDown(ByVal sender As Object, ByVal e_ As System.Windows.Forms.KeyEventArgs) Handles txtBox.KeyDown If e.KeyValue = keys.enter Or keys.right Then If String.IsNullOrEmpty(ActiveControl.Text) Then MessageBox.Show("Please Enter Data", "Error",_ MessageBoxButtons.OK, MessageBoxIcon.Error) Else 'Next Textbox recieves focus ... End If End If End Sub Does alpha or numeric textbox input cause the second IF, i.e., THEN IF to be evaluated? IF I remove either of the evaluants in the logical expression, this does NOT occur. :x According to the rules - as I understand them - e.KeyValue is an INTEGER. I've replaced the aforementiond keys. values in the above logical expression with discrete integers and it still doesn't work. :wtf: What I mean by doesn't work: if I take out one or the other of the logical expressions in the comparison, i.e. either .Enter or .Right (or the integer equivalent) the statement executes as expected. I'm dumbfounded how ~ input can evalute true in the above code (when its intent is to trap <enter> or <right> keys. This has got to be some sort of havengod (sp?) MS mystery pertaintent to KeyEventArgs and KeyPressEventArgs :duh: This is a real simple app I'm trying to create: read into memory a dynamic structure array, i.e., IP domain owner (string), IPv4 octets (bytes), IPv4 CIDR mask (byte) query the structure array by IPv4 IP address for fit w/in each discrete IPv4 / CIDR entry existing in DB. prompt user with Domain Name - IP addr owner if the the user provided IPv4 address exists in DB allow user to add IPv4/CIDR + 20char domain name IP owner label to binary DB (if not on file) resize structure array and sort said array in IPv4 address ascending order for new additions prohibit entry of alpha char into any IP octet or CIDR field (prompt user when input is invalid) prohibit <enter>, <right> arrow keys on IP/CIDR fields when null disable <search> DB button appearing unless all 4 IPv4 octes filled prohibit entry of numbers <0 & > 255 into any one of all 5 numberic fields prohibit number <0 or >24 in the CIDR field prohibit add button from appearing unless all 4 IP octect, CIDR & description fields contain appropriate values. remove both <search> and <add> buttons when information precludes them present <save> button when the initial structure array has been altered disappear the <save> button when not relevent. See? I told you it was simple.