|
-
Oct 11th, 2000, 02:57 AM
#1
Thread Starter
Member
How can i change a normaly Textbox on a form to a IP Box
Like:
. . .
(Where u can only between the Point insert valied numbers ( 0 to <256)
Help Please!
-
Oct 11th, 2000, 04:39 AM
#2
Thread Starter
Member
-
Oct 11th, 2000, 06:41 AM
#3
Hyperactive Member
Well...
I may have my MS Access head on but.....let's have a go anyway.
How about a validation function and let's say that your first IP text box is called ctlOctate1.
Place in form:-
Function ValidateData()
ValidateData = True
If ctlOctate1.Text > 256 Then
MsgBox "Please enter a valid IP Range.",
Me!ctlOctate1.SetFocus
ValidateData = False
End If
Call this from the ?OnExit? function of the text box itself, and maybe you could specify all 4 octates in the ValidateData Function?????????????????
If this is any help please tell me, also if it's complete and utter rubbish please tell me as I am a newbie and would like to learn from my mistakes.
Cheer Matt :-)
-
Oct 11th, 2000, 07:34 AM
#4
New Member
Take a look at the masked edit control.
-
Oct 11th, 2000, 07:52 AM
#5
Thread Starter
Member
Originally posted by Terry Cornwell
Take a look at the masked edit control.
Where????????????????????
-
Oct 11th, 2000, 09:08 AM
#6
Hyperactive Member
Look at the controls you have on your left in VB. The Mask edit control is called 'MaskEdBox', the little picture looks like this: ##|
Playing with its mask property should help you. Check out the help files on the mask edit control.
-
Oct 11th, 2000, 01:10 PM
#7
Fanatic Member
Just for the fun of it (and the experience) I'm writing an IPBox control. It allows entry of only numbers from 0 to 255, automatically displays and works with the .'s in the IP string, accepts text assignments of IPs and parses them, will allow OLEDragDrop operations, and Fore/Back Color properties. This is just a start, but I can get you a copy if you'd like it. I will release the code for the control under GPL when it's complete.
It's fun to play around with new ideas
-
Oct 12th, 2000, 03:38 AM
#8
Thread Starter
Member
-
Oct 12th, 2000, 10:10 AM
#9
Fanatic Member
For the most part, it's complete. If you'd like a copy, email me and I'll sent it back to you complete with source code and demo project. It currently has the following features:
TEXT [IPBox.Text = <string>, <string> = IPBox.Text]
Accepts an IP in the form of a string "xxx.xxx.xxx.xxx", if an element is left out, it will assume 0. If it is assigned a text string or DN, it will set all 0s (working on dns resolution for this feature). The return property returns what's in the textbox with a period delimited 32bit number (xxx.xxx.xxx.xxx).
CLEAR [IPBox.Clear]
Clears the IPBox and sets everything to 0's.
TAG [IPBox.Tag = <string>, <string> = IPBox.Tag]
Stores extra string information (like any other tag property)
FORE/BACKCOLOR [IPBox.ForeColor = &H0, IPBox.BackColor = RGB(255,255,255)]
Sets/returns the color of the IPBox text and background respectively.
APPEARANCE [IPBox.Appearance = ipb3D/ipbFlat]
Sets the appearance of the IPBox.
BORDERSTYLE [IPBox.BorderStyle = ipbFixedSingle/ipbNone]
Sets the borderstyle property.
You can also Enable/Disable the box, Lock/UnLock the box, etc.
The box behaves a bit like the box in the windows networking tcp/ip properties (or in dun tcp/ip properties). When you enter a number greater than 255, it will give you a message box telling you that it's too large a number and erases your input, you can cursor around the box (skips the periods), the backspace key will jump between fields as will the delete key. If you hit home or end, the cursor will jump to the beginning of the first number or the end of the last number.
If there is anything else you want added to the control, let me know. Since I'm releasing the source, if you add anything, please send me a copy of the new control
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
|