OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

[SOLVED] Get Item or Value from List Box

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
studio8
General User
General User


Joined: 14 Dec 2009
Posts: 15

PostPosted: Tue Dec 15, 2009 3:17 am    Post subject: [SOLVED] Get Item or Value from List Box Reply with quote

Hi there guys, i've been searching thoroughly, and i mean thoroughly, i can find anything... or so i thought... on the net...
and for some reason i just havent been able to find a solution to this...

I'm Trying to retrieve the Selected Item from a List Box and use that Value as a Determinant for another outcome...

i'm sorta new to BASIC HOWEVER my programming understanding is good...
here's what I have...
1 x ListBox (listbox1) (populated by a select query, so it in other words, there are items to select)
1 x Button (button1)
1 x Form (Standard)
when i click the Button i want the MsgBox to show me what value was chosen from the ListBox...

here's what i have so far:

Dim form as Object
Dim listbox1 as Object

form = ThisComponent.Drawpage.Forms.getbyName("Standard")
listbox1 = form.getbyName("listbox1")
MsgBox(listbox1.getSelectedItem())

everytime i try this i get a runtime error...
PLEASE HELP GUYS!!!
thanks in advance!!!


Last edited by studio8 on Thu Dec 17, 2009 7:29 am; edited 3 times in total
Back to top
View user's profile Send private message
RPG
Super User
Super User


Joined: 24 Apr 2008
Posts: 2697
Location: Apeldoorn, Netherland

PostPosted: Tue Dec 15, 2009 6:44 am    Post subject: Reply with quote

Hello

Study this link or link .

Maybe you need
oListbox.currentvalue

or if you realy want selecteditems

then

dim huidig( 1 to 10
huidig= oListbox.SelectedItems()

or print oListbox.SelectedItems(0)

I have not test the code

Romke
Back to top
View user's profile Send private message
studio8
General User
General User


Joined: 14 Dec 2009
Posts: 15

PostPosted: Thu Dec 17, 2009 7:07 am    Post subject: shot! Reply with quote

thanks for the reply RPG! gonna study that link now...

btw, is oListbox an Object that must be called? sounds like a stupid question, but i've been seeing it everywhere...

is it like some type of Object that references listboxes???

thanks in advance
_________________
if Everything goes well... try Trick Acid... it'll go even better
Back to top
View user's profile Send private message
studio8
General User
General User


Joined: 14 Dec 2009
Posts: 15

PostPosted: Thu Dec 17, 2009 7:14 am    Post subject: OH MY GOD Reply with quote

THANK YOU SOOOOO MUCH!!!!
IT"S WORKING!!!
YOU DON"T UNDERSTAND THE RIPPLE EFFECT OF THIS BUDDY!!!
YOU ARE THE GREATEST, IF YOU WERE A WOMAN, I"D MARRY YOU!!!

THANK YOU SO MUCH!!!

ok to clarify what i've done for those who may stumble across this in the future...

i just created a form with one listbox and one button, i.e.:
FORM contains
1 x Form (named "Standard")
1 x PushButton (named "button")
1 x ListBox (named "listbox)

ok the listbox is already populated, so it already has values to select... (and it's dropdown, doesn't really make a difference)...

i created a macro for the button called
"viewlistboxvalue"

ok the code is shown below:

Sub viewlistboxvalue

DIM form as Object
DIM listbox as Object

form = ThisComponent.Drawpage.Forms.getbyName("Standard")
listbox = form.getbyName("listbox")

MsgBox(listbox.currentvalue)

End Sub

the MsgBox function will show you if your code works basically by printing a pop-up to the screen of the current value of the listbox!

MUCH THANKS TO RPG!!!
YOU ARE A LEGEND!!!
_________________
if Everything goes well... try Trick Acid... it'll go even better
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group