Click here to Skip to main content
13,143,708 members (28,248 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I was asked to make a program where there is 3 listboxes, the 1st one has the list of names, the 2nd one should have the first name with lower case and the 3rd should have the last name in Upper case.

My problem is i double clicked on the 1st listbox( the one with names) and wrote this code
John Green
Malcolm Jackson

My problem is how to i have a seperate substring with different names, because the one above works only for the first names>??
2nd Question how can u have a listbox with cases whether its upper or lower.

Posted 17-Feb-13 18:57pm
Updated 18-Feb-13 6:03am
Which of the types named "ListBox" do you mean? Full name, please. And tag your application type or UI library.
Karthik Harve 18-Feb-13 1:20am
do you mean, once the full name is selected in first list box, the other list boxes must filled with first and last names respectively. is that your problem ?
Iman90 18-Feb-13 1:32am
Yes, exactly that but also have the first name in lower case and the last name in upper case

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Check the below code

Private Sub ListBox1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick
        If (ListBox1.SelectedIndex <> -1) Then
            Dim info(2) As String
            'Split the Firstname and Lastname using space
            info = ListBox1.SelectedItem.ToString().Split(" ")
            Dim fName As String = info(0) 'FirstName
            Dim lName As String = info(1) 'LastName
            ListBox2.Items.Add(fName.ToLower()) 'Convert to lower
            ListBox3.Items.Add(lName.ToUpper()) 'Convert to Upper

        End If
    End Sub

Best Regards

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170915.1 | Last Updated 18 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100