Click here to Skip to main content
15,887,596 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Find and copy files Pin
Garth J Lancaster22-Jan-14 14:42
professionalGarth J Lancaster22-Jan-14 14:42 
AnswerRe: Find and copy files Pin
Eldar Zeynalov24-Jan-14 19:07
Eldar Zeynalov24-Jan-14 19:07 
QuestionCopy / Paste Multiple Textboxes Pin
10kbps22-Jan-14 5:02
10kbps22-Jan-14 5:02 
AnswerRe: Copy / Paste Multiple Textboxes Pin
Dave Kreskowiak22-Jan-14 6:02
mveDave Kreskowiak22-Jan-14 6:02 
AnswerRe: Copy / Paste Multiple Textboxes Pin
Richard MacCutchan22-Jan-14 6:03
mveRichard MacCutchan22-Jan-14 6:03 
AnswerRe: Copy / Paste Multiple Textboxes Pin
Eddy Vluggen22-Jan-14 8:34
professionalEddy Vluggen22-Jan-14 8:34 
GeneralRe: Copy / Paste Multiple Textboxes Pin
10kbps22-Jan-14 9:13
10kbps22-Jan-14 9:13 
AnswerRe: Copy / Paste Multiple Textboxes Pin
Eddy Vluggen23-Jan-14 7:50
professionalEddy Vluggen23-Jan-14 7:50 
10kbps wrote:
I want to get somehow to user can copy all at once ID and be able to paste serial all at once not to fill one box by another, any help about it maybe some code snippet or something?
Here's something;
VB
Imports System.Windows.Forms

Module Module1

    Dim tb1 As TextBox
    Dim tb2 As TextBox
    Dim tb3 As TextBox

    Sub Main()
        Using f As New Form()
            tb1 = New TextBox With {.Dock = DockStyle.Left, .MaxLength = 3}
            tb2 = New TextBox With {.Dock = DockStyle.Left, .MaxLength = 5}
            tb3 = New TextBox With {.Dock = DockStyle.Left, .MaxLength = 3}
            f.Controls.AddRange(New Control() {tb3, tb2, tb1})

            AddHandler tb1.KeyDown, AddressOf KeyDown
            tb1.Focus()

            f.ShowDialog()
        End Using
    End Sub

    Public Sub KeyDown(sender As Object, e As KeyEventArgs)
        If e.KeyCode = Keys.V And e.Control = True Then
            ' did the enduser attempt a paste-operation?
            e.Handled = True

            DivideThisStringOverSomeTextBoxes(Clipboard.GetText)
        End If
    End Sub

    Public Sub DivideThisStringOverSomeTextBoxes(someString As String)
        ' our imaginary serial is 11 chars over 3 tb's; 123-45678-901
        ' first remove any - from the string
        Dim tempString As String = someString.Replace("-", "")
        tb1.Text = tempString.Substring(startIndex:=0, length:=3)
        tb2.Text = tempString.Substring(startIndex:=3, length:=5)
        tb3.Text = tempString.Substring(startIndex:=8, length:=3)
    End Sub

End Module
Mind you, this will explode if you post a string of ten characters; you'd still have to add in that check, before the substring is done Smile | :)
Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]

Questionconvert visual basic 6.0 to visual basic 2010 Pin
kikyamelia18-Jan-14 18:48
kikyamelia18-Jan-14 18:48 
AnswerRe: convert visual basic 6.0 to visual basic 2010 Pin
Peter Leow18-Jan-14 19:11
professionalPeter Leow18-Jan-14 19:11 
GeneralRe: convert visual basic 6.0 to visual basic 2010 Pin
kikyamelia18-Jan-14 20:21
kikyamelia18-Jan-14 20:21 
GeneralRe: convert visual basic 6.0 to visual basic 2010 Pin
Peter Leow18-Jan-14 20:36
professionalPeter Leow18-Jan-14 20:36 
AnswerRe: convert visual basic 6.0 to visual basic 2010 Pin
Eldar Zeynalov24-Jan-14 19:03
Eldar Zeynalov24-Jan-14 19:03 
AnswerRe: convert visual basic 6.0 to visual basic 2010 Pin
TheComputerMan31-Jan-14 5:07
TheComputerMan31-Jan-14 5:07 
QuestionSub reports Pin
Tsunamipudip17-Jan-14 2:10
Tsunamipudip17-Jan-14 2:10 
QuestionDelegates & Pointers Pin
Synth_Boy16-Jan-14 2:14
Synth_Boy16-Jan-14 2:14 
AnswerRe: Delegates & Pointers Pin
Paulo Zemek16-Jan-14 3:17
mvaPaulo Zemek16-Jan-14 3:17 
GeneralRe: Delegates & Pointers Pin
Synth_Boy16-Jan-14 4:20
Synth_Boy16-Jan-14 4:20 
AnswerRe: Delegates & Pointers Pin
Dave Kreskowiak16-Jan-14 3:31
mveDave Kreskowiak16-Jan-14 3:31 
GeneralRe: Delegates & Pointers Pin
Synth_Boy16-Jan-14 4:24
Synth_Boy16-Jan-14 4:24 
GeneralRe: Delegates & Pointers Pin
Ron Beyer16-Jan-14 4:50
professionalRon Beyer16-Jan-14 4:50 
GeneralRe: Delegates & Pointers Pin
Synth_Boy16-Jan-14 5:15
Synth_Boy16-Jan-14 5:15 
GeneralRe: Delegates & Pointers Pin
Ron Beyer16-Jan-14 5:17
professionalRon Beyer16-Jan-14 5:17 
GeneralRe: Delegates & Pointers Pin
Synth_Boy16-Jan-14 6:03
Synth_Boy16-Jan-14 6:03 
AnswerRe: Delegates & Pointers Pin
Synth_Boy30-Jan-14 22:02
Synth_Boy30-Jan-14 22:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.