So right now I have a code setup that will paste an ip address into 4 different text box's. However, if there is a port at the end, I need it removed.
This is the code I have at the moment, but it doesn't seem to work!
all help is appreciated!
This is the code I have at the moment, but it doesn't seem to work!
Code:
Dim ipaddr As String = Clipboard.GetText
Dim ocets As String() = ipaddr.Split(".")
Dim ocets2 As String() = ipaddr.Split(":")
Try
If ipaddr.Contains(":") Then
Try
TextBox5.Text = ocets(0).Trim
TextBox8.Text = ocets(1).Trim
TextBox9.Text = ocets(2).Trim
TextBox10.Text = ocets(3).Trim
TextBox10.Text.Remove(ocets2(1))
TextBox10.Text.Remove(":")
Catch ex As Exception
MsgBox("Error pasting IP.")
End Try
Else
TextBox5.Text = ocets(0).Trim
TextBox8.Text = ocets(1).Trim
TextBox9.Text = ocets(2).Trim
TextBox10.Text = ocets(3).Trim
End If
Catch ex As Exception
MsgBox("Error pasting IP, try copying again!")
End Try