CODE
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) < "0" Or Chr(KeyAscii) > "9" Then
KeyAscii = 0
End If
End Sub
Private Sub Combo2_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) < "0" Or Chr(KeyAscii) > "9" Then
KeyAscii = 0
End If
End Sub
Private Sub Combo3_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) < "0" Or Chr(KeyAscii) > "9" Then
KeyAscii = 0
End If
End Sub
Private Sub Combo4_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) < "0" Or Chr(KeyAscii) > "9" Then
KeyAscii = 0
End If
End Sub
Private Sub Command1_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
Text15.Text = ""
End Sub
Private Sub Command2_Click()
'Dim ip1, ip2, ip3, ip4 As Integer
'Dim net_incr As Integer
'If ip2 <> 255 Then
'net_incr = 256 - ip2
'Text5.Text = Text1.Text + "." + CStr(net_incr) + "0" + "." + "0"
'ElseIf ip3 <> 255 Then
'net_incr = 256 - ip3
'Text6.Text = Text1.Text + "." + Text2.Text + CStr(net_incr) + "0" + "0"
'ElseIf ip4 <> 255 Then
'Class A
'If Val(Text1.Text) <= 126 Then Text5.Text = Val(Text1.Text)
'If Val(Text1.Text) <= 126 Then Text8.Text = "0"
'If Val(Text1.Text) <= 126 Then Text9.Text = "0"
'If Val(Text1.Text) <= 126 Then Text10.Text = "0"
If Val(Text1.Text) <= 126 Then
Text5.Text = Val(Text1.Text)
Text8.Text = "0"
Text9.Text = "0"
Text10.Text = "0"
End If
'Class B
'If Val(Text1.Text) >= 127 Then Text5.Text = Val(Text1.Text)
'If Val(Text2.Text) <= 255 Then Text8.Text = Val(Text2.Text)
'If Val(Text1.Text) <= 127 Then Text8.Text = "0"
'If Val(Text1.Text) >= 127 Then Text9.Text = "0"
'If Val(Text1.Text) >= 127 Then Text10.Text = "0"
If Val(Text1.Text) >= 127 Then
Text5.Text = Val(Text1.Text)
Text8.Text = Val(Text2.Text)
Text9.Text = "0"
Text10.Text = "0"
End If
'class c
If Val(Text1.Text) >= 192 Then
Text5.Text = Val(Text1.Text)
Text8.Text = Val(Text2.Text)
Text9.Text = Val(Text3.Text)
Text10.Text = "0"
End If
'If Val(Text1.Text) >= 1 Then Text5.Text = Val(Text1.Text)
'If Val(Text2.Text) <= 255 Then Text8.Text = Val(Text2.Text)
'If Val(Text1.Text) <= 127 Then Text8.Text = "0"
'If Val(Text1.Text) >= 127 Then Text9.Text = "0"
'If Val(Text1.Text) >= 127 Then Text10.Text = "0"
'else if val(text)
'End If
'broadcast addr 4 class a
If Val(Text1.Text) <= 126 Then
Text6.Text = Val(Text1.Text)
Text11.Text = "255"
Text12.Text = "255"
Text13.Text = "255"
End If
'broadcast addr 4 class b
If Val(Text1.Text) >= 127 Then
Text6.Text = Val(Text1.Text)
Text11.Text = Val(Text2.Text)
Text12.Text = "255"
Text13.Text = "255"
End If
'broadcast addr 4 class c
If Val(Text1.Text) >= 192 Then
Text6.Text = Val(Text1.Text)
Text11.Text = Val(Text2.Text)
Text12.Text = Val(Text3.Text)
Text13.Text = "255"
End If
' no of possile ntwk id class A
If Val(Text1.Text) <= 126 Then
Text14.Text = 2 ^ 7 - 2
End If
' no of possile ntwk id class b
If Val(Text1.Text) >= 128 Then
Text14.Text = 2 ^ 14
End If
' no of possile ntwk id class c
If Val(Text1.Text) >= 192 Then
Text14.Text = 2 ^ 21
End If
'usable no of ntwkid bits 4 class a
If Val(Text1.Text) <= 126 Then
Text15.Text = 2 ^ 3 - 1
End If
'usable no of ntwkid bits 4 class b
If Val(Text1.Text) >= 128 Then
Text15.Text = 2 ^ 4 - 2
End If
'usable no of ntwkid bits 4 class c
If Val(Text1.Text) >= 192 Then
Text15.Text = 24 - 3 'since its a class c ip address its have 24 bits at the ntwk portion i.e NNNH-3
End If
End Sub
Private Sub Command3_Click()
Dim a As String
a = MsgBox("Sure to exit?", vbQuestion + vbYesNo, "Exiting...")
If a = vbNo Then Exit Sub
Unload Me
End Sub
Private Sub Text1_Change()
'Combo1.Enabled = True
'Combo1.Text = 255
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
'If Not IsNumeric(Text1.Text) Then Exit Sub
If Chr(KeyAscii) < "0" Or Chr(KeyAscii) > "9" Then
KeyAscii = 0
End If
End Sub
Private Sub Text2_Change()
'Dim x As Integer
'Text2.Text = x
'Combo2.Enabled = True
'If ip1 < 191 Then
'Combo2.Text = 255
'End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
On Error Resume Next
'If Chr(KeyAscii) < "0" Or Chr(KeyAscii) > "9" Then
'KeyAscii = 0
'End If
'MsgBox "Only three Characters allowed"
'End If
If Val(Text2.Text) >= 255 Then
MsgBox "Only values lessthan 255 are allowed"
End If
End Sub
Private Sub Text3_Change()
Combo3.Enabled = True
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) < "0" Or Chr(KeyAscii) > "9" Then
KeyAscii = 0
End If
End Sub
Private Sub Text4_Change()
Combo4.Enabled = True
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) < "0" Or Chr(KeyAscii) > "9" Then
KeyAscii = 0
End If
End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) < "0" Or Chr(KeyAscii) > "9" Then
KeyAscii = 0
End If
End Sub
Private Sub Text6_KeyPress(KeyAscii As Integer)
'If Chr(KeyAscii) < "0" Or Chr(KeyAscii) > "9" Then
'KeyAscii = 0
'End If
End Sub
Private Sub Text7_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) < "0" Or Chr(KeyAscii) > "9" Then
KeyAscii = 0
End If
End Sub