Results 1 to 3 of 3

Thread: ComboBox SelectedItem to Text...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2010
    Posts
    82

    Red face ComboBox SelectedItem to Text...

    Here's what I'm looking for but I haven't come up with an idea on how to approach the issue...

    Basically the application I'm creating has a login screen with two textboxes and one ComboBox... Once the user enters their first and last time for the first time it'll be stored in the combobox's index..

    Now my issue is this... Originally before I implemented the combobox the related user file name would be:

    "C:\FicheStats\John Smith\January\" + Textbox1.text + Textbox2.text + ".txt"

    So basically the user filename would be JohnSmith.text

    But now I want the user to directly select from the combobox and that the file name remains the same without space.... but in the combobox the name appears as John Smith...

    Now what I want to do is tell the program that the name in the combobox is the filename but without a space... so i'd need to find way for the program to read John Smith as JohnSmith or tell the program that when there is a space to bind both text parts >_>

  2. #2
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: ComboBox SelectedItem to Text...

    Well if it is always going to be the same format, where you just want to remove any spaces, then you could just use String.Replace to replace the space with nothing, e.g something like:

    vb Code:
    1. Dim FileName As String
    2. FileName = ComboBox1.SelectedItem.ToString.Replace(" ", String.Empty)
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2010
    Posts
    82

    Re: ComboBox SelectedItem to Text...

    thanks I'll try it soon

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