[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Getting info from a string in a listbox

Posted on 1998-10-09
3
Medium Priority
?
138 Views
Last Modified: 2010-04-30
Say there are multiple strings of information in a list box with a person's first name then last name then phone number in that order, and there is a button next to the list box that should only get the selected person's first name from the string and stores it in a global variable. How do you code the button so this occurs?
0
Comment
Question by:Gardiun
[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
3 Comments
 
LVL 14

Accepted Solution

by:
waty earned 150 total points
ID: 1439061
you should separate each item with a character :

ex :
 cbCombo.Add sFirstName & ";" & sLastName & ";" & sPhone

or

 cbCombo.Add sFirstName & vbTab & sLastName & vbTab & sPhone


in the command button, do as follow :

 sLine = cbCombo.List(cbCombo.ListIndex)
 nPos = Instr(sLine , ";") ' or nPos = Instr(sLine , vbTab)
 sFirsName = Left(sLine , 1, nPos-1)

0
 

Author Comment

by:Gardiun
ID: 1439062
It has a problem with this line:
sFirsName = Left(sLine , 1, nPos-1)

The message read "wrong number of arguments or invalid property assignment." What did you declare nPos as?
0
 
LVL 14

Expert Comment

by:waty
ID: 1439063
Dim sFirsName as String
dim sLine as String
dim nPos  as long
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

649 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