Nazgulled Posted March 12, 2006 Posted March 12, 2006 Is it possible to have a textbox to act like the ones in the network connections in the TCP/IP properties? how? Quote
Leaders snarfblam Posted March 12, 2006 Leaders Posted March 12, 2006 The .NetFramework 2.0 has a masked textbox control which allows you to set a mask for input. You also need to verify the values entered, making sure that each number is less than 256. Quote [sIGPIC]e[/sIGPIC]
Nazgulled Posted March 13, 2006 Author Posted March 13, 2006 thanks... however, i'm having difficulties to convert the string of the masked textbox to int to see if it's less than 256... Private Sub mtxtLIP_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles mtxtLIP.KeyUp Dim segments As String() = mtxtLIP.Text.Split(".") Dim segment As String For Each segment In segments If segment > 255 Then picLIP.Visible = True Else picLIP.Visible = False End If Next End Sub Obviously, this doesn't work... but I tried many int conversions and none of them worked... Quote
Cags Posted March 13, 2006 Posted March 13, 2006 If int.Parse(segment) > 255 Then *NB it sounds like your using .Net 2.0 in which case you could use TryParse(), if you do however note the overload is different to Parse() Quote Anybody looking for a graduate programmer (Midlands, England)?
Administrators PlausiblyDamp Posted March 13, 2006 Administrators Posted March 13, 2006 Just to add my own 2 pence worth... When using VB I would always recommend putting Option Strict On at the top of every source file. In fact I would make this the default under Tools->Options->Projects And Solutions->VB Defaults Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Nazgulled Posted March 13, 2006 Author Posted March 13, 2006 If int.Parse(segment) > 255 Then *NB it sounds like your using .Net 2.0 in which case you could use TryParse(), if you do however note the overload is different to Parse() That didn't work, nor Integer.parse() I had to solve it with the tryparse() thanks... I thought I had option strict on but I guess I was wrong. If I enable it globally in the options, I'll still have to add it to my program right? Unless I start to create a new project... right or wrong? Quote
Cags Posted March 13, 2006 Posted March 13, 2006 Thats my fault int is a C# type. Perhaps Single.Parse() would have worked better. Quote Anybody looking for a graduate programmer (Midlands, England)?
*Experts* Nerseus Posted March 13, 2006 *Experts* Posted March 13, 2006 I did a google search for "IP Address textbox c#" without the quotes and came up with the following: http://www.codeproject.com/cs/miscctrl/IPAddressTextBox.asp He address a LOT more issues that you were/are probably interested in, but still might prove useful. Glad to see you got the parsing fixed. :) Note: I didn't actually look in detail at what was posted so I'm not saying it's definitely an example of clean code. Just thought I'd offer up the link in case it happens to work for you. -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.