Results 1 to 3 of 3

Thread: IP Address control

  1. #1

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    IP Address control

    I was in need of an IP control. Strangely enough there is nothing solid in the forum and more strange I could not find anything on the net , just some gibberish examples that work at some features.
    I did find a C# control but the code was over stuffed and extremely complicated for that matters and the control was on XAML, that, apparently, did not do it for me.

    So I decided to write a simple IP Address control with simple code that everyone can understand.

    I will be providing the solution.If you don't want the control and you just need the code you can copy paste everything but the override text declaration. that would need to be inserted manually.
    You would also need to check the textbox control properties as some are changed from the original textbox.
    The control is basically textboxes merged together, fine and simple, an the functionality includes the 0-255 numbers the dot,comma,arrows navigation with focus, numbers only and no spaces between.
    Feel free to change anything, if you might want the spaces closer or change the events.
    The solution is on VS2015 but as there is no over sophisticated coding, I supposed it will work with previous versions as well.

    If you want to see the control before even bothering, the finished control looks like this:

    Name:  IP.jpg
Views: 903
Size:  2.5 KB

    Code here:

    IPControl.zip
    Last edited by sapator; Jan 8th, 2021 at 12:21 AM. Reason: Update Added Features
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: IP Address control (v4)

    Was there any reason why the MaskBox wouldn't suffice?
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  3. #3

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: IP Address control (v4)

    Yes.
    That was the exact reason I did not use a masked textbox and did this one.
    I can't remember exactly what was the issue as I really erased the whole idea from my mind the minute I saw that the masked textbox control was problematic, but i think it was either the navigation or the empty space or the masked chars or something similar.
    If I where to show the code I'm using this control for, there are leftovers from a masked textbox that failed to suffice.
    Also if you look at many topics, masked textbox has issues in general for this kind of implementation.
    Last edited by sapator; Feb 18th, 2021 at 05:49 PM.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

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