Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

extracting a string from a combobox text string - vb.net 2003

Posted on 2006-11-28
2
Medium Priority
?
676 Views
Last Modified: 2012-06-27
Hi Experts,

I have a combobox on a winform which has ITEMS of names displayed in the format of "surname, firstname".  When a name is selected from the combobox, I'd like to display just the firstname in Textbox1.text.

Textbox1.text = "Hi " & string = "firstname (only)" from combobox1.text

It's important that the format of the combobox be kept intact.  I've goofed around with code, but need a little help.

Cheers,
Roberto
0
Comment
Question by:RobertoFreemano
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Accepted Solution

by:
gecko_au2003 earned 200 total points
ID: 18032508
Dim i As String = combobox1.text
    Dim a() As String
    Dim j As Integer
    a = i.Split(",")
    For j = 0 To a.GetUpperBound(0)
    MsgBox(a(j))
    Textbox1.text= a(j)
    Next

Put that in the click event of the combo box and if it works then just comment out the messagebox in the for next loop :)
0
 

Author Comment

by:RobertoFreemano
ID: 18035185
Thanks, gecko_au2003
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Six Sigma Control Plans

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question