|
-
Nov 11th, 2016, 04:10 AM
#7
Thread Starter
Lively Member
Re: Acquiring the index number in a listbox
 Originally Posted by jmcilhinney
You don't have to apologise. We are here to help after all. What you do need to do is provide a FULL and CLEAR explanation of what you're trying to do. We can't really help otherwise, or else we'll waste our time and yours making false starts.
Thanks for that so let's start afresh.
I work within the pharmacy world and my expertise is with Excel. In Excel I created a buying model, but, by the very nature of the beast, the spreadsheets are becoming unwieldy. I deal with over 90,000 products all of which have APPID codes, VPPID codes, Pipcodes, pack sizes, unit of measurement, tariffs, etc, etc. So I've set about developing a stand-alone program that can cope with all of the numerous calculations, etc in a more efficient way.
Initially I created a series of .txt files from the original Excel sheet and made a start in VB creating a basic way to display details of a product (codes, etc) when it was selected from a list. I managed to work out how to populate the lists from the .txt files using:
Dim Prods() As String = IO.File.ReadAllLines("E:\Rajja\TxtFiles\Product1.txt") - this populates all of the product names.
I used this to populate a ListBox and included a 'search' textbox on the form for the user to type the name of a product. As they type, the products are highlighted in the listbox.
Obviously there are a lot of products that start with the same characters, so the more they type, the more exact is the match; but the need to be able to select the exact match from the list which will open a form displaying the full details of that product.
As all of the txt files involved are in the same sorted order, I thought that if I got the index of the selected product and stored that in a variable (ind) then it would be straightforward to find corresponding information in the other files by using, e.g. VPPID(ind); APPID(ind) etc., hence the need to get hold of the index and place it in a variable.
Not sure if all of that makes sense - it does in my head but, as I said, I'm teaching myself VB and at the age of 72 it's not an easy task; but it certainly keeps the brain active!!!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|