Results 1 to 4 of 4

Thread: [RESOLVED] Inserting special characters at the beginning & end of user input

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2015
    Posts
    2

    Resolved [RESOLVED] Inserting special characters at the beginning & end of user input

    Hi,

    I'm creating a simple barcode generator in Visual Basic
    Currently a barcode has to be typed in by a user like: *DIS17*, *DIS16*, *DIS17* etc to generate it correctly.
    My issue is that the client does not want to have to type the *s in, at risk of confusion.
    Is there any possible way to do this? I've been searching for hours and found nothing suitable yet!

    I'm a student doing this at a work placement and I would really appreciate the help!

    Thanks,
    Hayley

    Code I used:

    Private Sub btnGenerate_Click(sender As Object, e As EventArgs) Handles btnGenerate.Click
    'set txtBarcode to have the same data that was entered into the txtRackID textbox.
    'txtRackID is set to the font 'Free 3 of 9', which converts the text to the matching barcode.

    txtBarcode.Text = txtRackID.Text
    End Sub

    Attachment 125201Attachment 125203

  2. #2
    Fanatic Member Toph's Avatar
    Join Date
    Oct 2014
    Posts
    655

    Re: Inserting special characters at the beginning & end of user input

    Look at this.

    Code:
    Dim output As String = "*" & txtBarcode.Text & "*"
    
    Messagebox.Show(output)

    is that that what you wanted?

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2015
    Posts
    2

    Re: Inserting special characters at the beginning & end of user input

    Yes, it is. Thanks!
    I tried that but completely forgot the & signs.

    Thanks again.

  4. #4
    Fanatic Member Toph's Avatar
    Join Date
    Oct 2014
    Posts
    655

    Re: [RESOLVED] Inserting special characters at the beginning & end of user input

    It's called string concatenation. You might want to Google the term in order to gain better understanding.

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