|
-
Nov 7th, 2009, 11:36 AM
#1
Thread Starter
New Member
Getting filenames into Combo Box--(IPBasic/Image Pro)
Hello all,
I'm new to the forums and very limited w/ coding experience, so please forgive me if this is a total noob type question. Also, I'm working w/in the image analysis program Image Pro w/ it's built in VisualBasic tools. Not sure if that matters.
My issue: I need to get a list of specific files from a directory into a combo box for the user to then select from. I know how to look through the directory to find the files I want. What I don't know is how to take this list into an array, which can then be used to populate the combo box. Any help, advice, tips and tricks is very welcome. Thank you all so much for yor help.
Here is what I came up w/ to search and get the file names. I know it works when I debug.print the names....but how to get this:
Code:
Sub MakeCount_Measure_FileList ()
Dim sDirectory As String
Dim sFilter As String, NFiles%, i%
Dim FileNameCB As String*255
sDirectory="C:\iAM"
sFilter="*.env*"
'Get number of files
NFiles = IpStSortedList(sDirectory,sFilter,SORT_GET_NFILES,IPNULL)
ReDim FileList(NFiles) As Integer
'get list sorted by name
ret=IpStSortedList(sDirectory,sFilter,SORT_BY_NAME_ASC,FileList(0))
'print list
For i=0 To NFiles-1
'Get file Name
If IpStSearchDir (sDirectory,sFilter, FileList(i), FileNameCB)=1 Then 'print only files, skip folder names
Debug.Print i & " " & FileNameCB
End If
Next
End Sub
Get that list into this combo box:
Code:
Dim ListArray$()
ListArray$() = FileNameCB
Begin Dialog UserDialog 820,427,"Select Count/Measure File" ' %GRID:10,7,1,1
ComboBox 70,49,680,322,FileNameCB,.ComboBox1
OKButton 350,385,120,28
End Dialog
Dim dlg As UserDialog
Dialog dlg
End
-
Nov 7th, 2009, 11:46 AM
#2
Re: Getting filenames into Combo Box--(IPBasic/Image Pro)
Welcome to VBForums 
While the "VB Editor" in programs tends to be based on VBA 6 (and thus similar to VB6), that code looks very different to VB6 - particularly in terms of the things that are relevant to your question.
As such the VB6 forum isn't really the best place, so I've moved this thread to our "Other BASIC" forum.
-
Nov 7th, 2009, 11:54 AM
#3
Thread Starter
New Member
Re: Getting filenames into Combo Box--(IPBasic/Image Pro)
OK, thank you. And sorry about that. To tell you the truth I am a Biological Oceanographer and, thus, very illiterate about this VB stuff. But also am very eager to learn more. I appreciate how much time VB saves me with me work and can't wait to become skilled w/ it.
-
Nov 7th, 2009, 06:48 PM
#4
PowerPoster
Re: Getting filenames into Combo Box--(IPBasic/Image Pro)
Code:
Open "Test.txt" For Output As #1
Close #1
Rem Attach the variable for the file to the Open statement, as above.
Form1.Combo1.AddItem Item1, "0"
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Nov 7th, 2009, 06:49 PM
#5
PowerPoster
Re: Getting filenames into Combo Box--(IPBasic/Image Pro)
What kind of file extension are you using??? Cause I can't tell with your code!!
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Nov 8th, 2009, 10:21 AM
#6
Thread Starter
New Member
Re: Getting filenames into Combo Box--(IPBasic/Image Pro)
Good morning.
I don't know what you mean by what type of file extension I am using? Do you mean what type of file I am looking for in the directory to list as file names that I am trying to get into my combo box? If so, the file type is an .env file. In my code this file type is held by the variable sFilter.
This file type is specific to the imaging program that I use, and it is basically just a list of specific count/measurement/size settings to either count, or not count, certian objects (cells in my case) that have been segmentated out of a digital image.
-
Nov 8th, 2009, 06:18 PM
#7
PowerPoster
Re: Getting filenames into Combo Box--(IPBasic/Image Pro)
Well I will try to help you, as much as I can!!
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Nov 8th, 2009, 06:20 PM
#8
PowerPoster
Re: Getting filenames into Combo Box--(IPBasic/Image Pro)
Visual Basic doesn't have a Begin command. What kind of lingo are you using to do this. It looks like C++ or something like that.
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Nov 8th, 2009, 06:22 PM
#9
PowerPoster
Re: Getting filenames into Combo Box--(IPBasic/Image Pro)
Well Visual Basic looks something like this...
Code:
Dim sDirectory As String
Dim sFilter As String
Dim NFiles As String
Dim FileNameCB As String
sDirectory = "C:\iAM\"
sFilter = "*.env"
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Nov 9th, 2009, 10:12 AM
#10
Thread Starter
New Member
Re: Getting filenames into Combo Box--(IPBasic/Image Pro)
Thanks ThEiMp, I appreciate any help that I can get.
Well, it is actually VBA, so that is why some things are different then true VB. (And why I have a hell of a time trying to find an answer to my question simply by searching and copying others' codes). It's a VBA thing within my image analysis software. However, you can use pure VB in it, so if there is some way to get it to work using only visual basic, that is cool too.
The Begin command you are refering to is for the Combo box. I think that it shows up in the code that way b/c I used the "User Dialouge Box" GUI creater to make that box.
So, when it is all said and done I don't care if this works using the VBA type code or regular VB type code. As long as I can get a list of my *.env files into the combo box, and then when a user selects one from the list and presses OK that string (name from the box) or an integer is fine too, is out-put.
The goal w/ this is: These are all different count/measure setting files that get applied to images that are run through my script. And I'd like to be able to select a file, and then that is passed down in the code and applied to the image being processed. I've got it working great as long if I hard code the file name into my script, but that doesn't leave any flexability for being able to change/select a different count/measure file if I or another user wants to do so.
Again, thanks for trying to help. It is so kind. Bless the forums, and forum members!
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
|