Results 1 to 9 of 9

Thread: Change Textbox into a IP BOX! How??????

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    51

    Question

    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!

  2. #2

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    51
    Help ..:-))))

  3. #3
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298

    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 :-)

  4. #4
    New Member
    Join Date
    Oct 2000
    Posts
    9
    Take a look at the masked edit control.

  5. #5

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    51

    Question

    Originally posted by Terry Cornwell
    Take a look at the masked edit control.
    Where????????????????????

  6. #6
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489
    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.

    Chris

  7. #7
    Fanatic Member ExcalibursZone's Avatar
    Join Date
    Feb 2000
    Location
    Western NY State
    Posts
    908
    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
    -Excalibur

  8. #8

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    51
    Jeahh...thx a lot

  9. #9
    Fanatic Member ExcalibursZone's Avatar
    Join Date
    Feb 2000
    Location
    Western NY State
    Posts
    908
    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
    -Excalibur

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width