PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197 IP Textbox User Control-VBForums
I made this user control to mimic the IP textbox in the Windows TCP/IP settings. It's different than a masked box or just straight custom validation, in that it is actually 4 textboxes that look like 1 textbox.
If you check the TCP/IP settings in Windows, you will see that this is how their box behaves. It works pretty well. Please let me know any comments/suggestions.
Attached is the full source code, and a sample project showing it in action. Since I did not include any compiled code, you need to build the project before you view form1.
Using VS.NET 2013/.NET 2.0 through 4.5 * Please mark you thread resolved using the Thread Tools above
PLEASE INDICATE WHAT VERSION OF VB YOU USE!!!!!!!!!!! * If you found a post useful then please Rate it! * DO NOT PM ME WITH LINKS TO YOUR THREADS FOR ANSWERS PLEASE!
From your project just select "Add existing item" and find the IPTextBox.vb file from my project. Once you add it to your project, build your project and the control will appear in your toolbox.
Using VS.NET 2013/.NET 2.0 through 4.5 * Please mark you thread resolved using the Thread Tools above
PLEASE INDICATE WHAT VERSION OF VB YOU USE!!!!!!!!!!! * If you found a post useful then please Rate it! * DO NOT PM ME WITH LINKS TO YOUR THREADS FOR ANSWERS PLEASE!
Firstly Great stuff!! I tried to create a IP masked textbox in VB2005 using 099.099.099.099 but this didn't quite give me the result I was looking for.
Couple of suggestions for this but it could be what you mean by user controls.
1, When a . is pressed it moves to the next box or a backspace on the last char in a box moves you to the last box
2, Copy and paste function - ability to copy the content or paste content in
If you could point me in the right direction that would be much appreciated
Thanks
Last edited by Robbrad182; Dec 20th, 2006 at 04:41 AM.
Since the user control was build to behave like the windows IP entry box, it is actually made up of 4 textboxes. So you can't copy/paste an entire IP. (you could, but you would have to write more code to look at a paste, see if its a full valid IP, and then fill in each of the 4 textboxes)
Using VS.NET 2013/.NET 2.0 through 4.5 * Please mark you thread resolved using the Thread Tools above
PLEASE INDICATE WHAT VERSION OF VB YOU USE!!!!!!!!!!! * If you found a post useful then please Rate it! * DO NOT PM ME WITH LINKS TO YOUR THREADS FOR ANSWERS PLEASE!
Why not make it so that you cannot enter 0 0 0 0 or 255 255 255 255 which an IP address cannot be. ¿
Actually in Windows when it's obtaining an ip address or you use 'IpConfig /Release' The system's IP is '0.0.0.0' and 255.255.255.255 is a valid ip, it's just not one you see
Currently using VS 2015 Enterprise on Win10 Enterprise x64.
Using VS.NET 2013/.NET 2.0 through 4.5 * Please mark you thread resolved using the Thread Tools above
PLEASE INDICATE WHAT VERSION OF VB YOU USE!!!!!!!!!!! * If you found a post useful then please Rate it! * DO NOT PM ME WITH LINKS TO YOUR THREADS FOR ANSWERS PLEASE!
I have added this sub as a new private sub, so every time you type Enter the current textbox transfers you to the next one.
vb Code:
PrivateSub txtIP_KeyDown(ByVal sender As System.Object, ByVal e As KeyEventArgs) Handles txtIP1.KeyDown, txtIP2.KeyDown, txtIP3.KeyDown, txtIP4.KeyDown
Dim txtBox As TextBox = DirectCast(sender, TextBox)
Just stopping in to say i like the custom control!
I know this is an old thread, but i was wondering how can you change the default values on this, i would like to see all blanks instead of 255.255.255.255
→ The Comprehensive Guide to Cloud Computing
A complete overview of Cloud Computing focused on what you need to know, from selecting a platform to choosing a cloud vendor.