INTERACT FORUM
Windows => Plug-in Development => Topic started by: llafriel on October 14, 2009, 11:32:38 am
-
Hello again.
I want to search MC' database and present the result in a listbox. The search works fine, but getting the result into a listbox gives me errors. The code below sort of works but it fills the listbox with 'System.__comObject' for every searchhit.
Dim list As MediaCenter.IMJFilesAutomation
Dim antall, teller As Integer
search = "[Video Type]=[Film]"
list = mediaCenterRef.Search(search)
antall = list.GetNumberFiles()
TextBox1.Text = antall
For teller = 0 To antall
ListBox1.Items.Add(list)
Next
-
i guess you want the names filling that listbox? i would add the next item to the script, i can be wrong, did not test it.
first i would use:
For teller = 0 To antall -1
then you should get the name from the list:
Dim listitem As MediaCenter.IMJFileAutomation
Dim MName as string
listitem = list.GetFile(teller)
MName=Listitem.Get("Name", False)
and use that in :
ListBox1.Items.Add(MName)
the result could be something like:
Dim list As MediaCenter.IMJFilesAutomation
Dim listitem As MediaCenter.IMJFileAutomation
Dim MName as string
Dim antall, teller As Integer
search = "[Video Type]=[Film]"
list = mediaCenterRef.Search(search)
antall = list.GetNumberFiles()
TextBox1.Text = antall
For teller = 0 To antall - 1
listitem = list.GetFile(teller)
MName=Listitem.Get("Name", False)
ListBox1.Items.Add(MName)
Next
hope it gives some ideas.
:)
gab
-
Hello again.
I want to search MC' database and present the result in a listbox. The search works fine, but getting the result into a listbox gives me errors. The code below sort of works but it fills the listbox with 'System.__comObject' for every searchhit.
Dim list As MediaCenter.IMJFilesAutomation
Dim antall, teller As Integer
search = "[Video Type]=[Film]"
list = mediaCenterRef.Search(search)
antall = list.GetNumberFiles()
TextBox1.Text = antall
For teller = 0 To antall
ListBox1.Items.Add(list)
Next
I just did a very similar thing earlier today. I added the filenames from an MC db search to a List object. I think the changes shown in red below will fill your listbox. You can replace "Name" with whatever database field you need.
Dim list As MediaCenter.IMJFilesAutomation
Dim antall, teller As Integer
search = "[Video Type]=[Film]"
list = mediaCenterRef.Search(search)
antall = list.GetNumberFiles()
TextBox1.Text = antall
For teller = 0 To antall-1
ListBox1.Items.Add(list.Get(teller,"Name").Tostring)
Next
-
Great stuff guys, just what i needed. Thanks! :)