|
-
Oct 10th, 2000, 02:57 AM
#1
Thread Starter
Member
How ca i codec a Textbox that only a "valied IP Adress" can be insert? only numbers 0 and <256.
-
Oct 10th, 2000, 02:59 AM
#2
Frenzied Member
Split the IP address up into its 4 numbers, using the InStr() and Mid() functions, and then check that each is between 0 - 255. You can use the Val() function to convert a string to a number.
Harry.
"From one thing, know ten thousand things."
-
Oct 10th, 2000, 03:02 AM
#3
Thread Starter
Member
Ip Adress
Ca u give me an example? im really a beginner :-))
thx a lot
-
Oct 10th, 2000, 07:09 AM
#4
Thread Starter
Member
HELP!!!
i need a code for this.....can anybody help me?????
-
Oct 10th, 2000, 08:43 AM
#5
Frenzied Member
I doing just that in one of my apps.
To break out the address bytes:
Code:
Dim sIP As String
Dim cntl As Integer
' extract the IP address byte values from gsHost
sIP = gsRHost
cntl = InStr(sIP, ".")
txtIPAddr1.Text = Left$(sIP, cntl - 1)
sIP = Mid$(sIP, cntl + 1)
cntl = InStr(sIP, ".")
txtIPAddr2.Text = Left$(sIP, cntl - 1)
sIP = Mid$(sIP, cntl + 1)
cntl = InStr(sIP, ".")
txtIPAddr3.Text = Left$(sIP, cntl - 1)
sIP = Mid$(sIP, cntl + 1)
txtIPAddr4.Text = sIP
And to put it all back together:
Code:
gsRHost = txtIPAddr1.Text & "." & _
txtIPAddr2.Text & "." & _
txtIPAddr3.Text & "." & _
txtIPAddr4.Text
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|