Solved

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

Posted on 2006-11-28
2
668 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
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 …

758 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

21 Experts available now in Live!

Get 1:1 Help Now