Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 Customizing a "Paste" button.

$
0
0
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!

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

all help is appreciated!

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>