Results 1 to 8 of 8

Thread: [RESOLVED] VB.Net - Paste value into 2 TextBox

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2021
    Posts
    23

    Resolved [RESOLVED] VB.Net - Paste value into 2 TextBox

    Hi

    I would like to use a button to paste a value into 2 textbox with a specific formatting.

    Ex:
    If i have copied to clipboard the value:
    Code:
    46.57180476969694, -82.05882047395006
    Or
    Code:
    46.57180476969694; -82.05882047395006
    When i would click on the button, it would paste in TextBox1: 46.5718, and in TextBox2: -82.0588.

    So i only need 4 digits after decimal.

    I've tried like below:
    Code:
      Dim strTemp As String
            Dim strParts() As String
            On Error Resume Next
            strTemp = Clipboard.GetText
            'Google Map
            strParts = Split(strTemp, ",")
            TextBox1.Text = Split(strParts(0), ".")(0) & "." & Left$(Split(strParts(0), ".")(1), 4)
            TextBox2.Text = Split(strParts(1), ".")(0) & "." & Left$(Split(strParts(1), ".")(1), 4)
            Return
    But that does not work at all.

    How can i do that? Sometime i could have as a separator "," and other time ";".

    In VB6, i used to use GoSub, but that does not work for VB.Net

    Thank you.
    Last edited by Wilder1234; Aug 2nd, 2021 at 04:37 PM.

Tags for this Thread

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