Solved

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

Posted on 2006-11-28
2
669 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
2 Comments
 
LVL 23

Accepted Solution

by:
gecko_au2003 earned 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adobe Customization Wizard XI issues 26 206
strCopies  challenge 17 82
groupSumClump challenge 9 98
PHP question(s) about order of output 9 57
A short article about a problem I had getting the GPS LocationListener working.
This is an explanation of a simple data model to help parse a JSON feed
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

914 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now