|
-
Mar 18th, 2001, 11:12 AM
#1
Thread Starter
Fanatic Member
hi
i have a combo box with 5 options in it
sound 1
sound 2
sound 3
sound 4
sound 5
and i have set the style to 2, but when the program runs the option box is blank, i can't change the text because it is read only with this style option so i was wondering how i could set a default option to be in the combo box when the program runs.
thanks
Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
-- Linus Torvalds
[ Galahtech.com] | [ My Site] | [ Fishsponge] | [ UnixForum.co.uk]
-
Mar 18th, 2001, 11:21 AM
#2
In design mode, set the text property to which ever option you want as the default.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 18th, 2001, 11:25 AM
#3
Thread Starter
Fanatic Member
I tried that, but i have set the style to 2 and that means that i can't change it, it says that this is set to read only, if i change the style to 1 then change the text and then change the style back to 2 it still comes up wrong, any more ideas ??
Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
-- Linus Torvalds
[ Galahtech.com] | [ My Site] | [ Fishsponge] | [ UnixForum.co.uk]
-
Mar 18th, 2001, 11:28 AM
#4
isn't there a Selected property? try
Code:
Combo1.Selected(0) = True
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 18th, 2001, 11:34 AM
#5
Thread Starter
Fanatic Member
No there isn't a selected option, and even if i type it in it still doesn't work, it says method or data member not found, any more ideas
sorry to be a nuisance
Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
-- Linus Torvalds
[ Galahtech.com] | [ My Site] | [ Fishsponge] | [ UnixForum.co.uk]
-
Mar 18th, 2001, 11:34 AM
#6
scratch that, use this :
Code:
Private Sub Form_Load()
Combo1.Text = Combo1.List(0) ' where 0 is the index of your default
End Sub
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 18th, 2001, 11:38 AM
#7
Thread Starter
Fanatic Member
Guess what,
Code:
'text' property is read only
aaagggghhhhh
is there a way to do this at all?? i would of thought that your last suggestion would of worked
Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
-- Linus Torvalds
[ Galahtech.com] | [ My Site] | [ Fishsponge] | [ UnixForum.co.uk]
-
Mar 18th, 2001, 11:39 AM
#8
Actually, its better to set the ListIndex property because it will actually set an item rather than just change the text.
Code:
'Set the 1st item to the default.
Combo1.ListIndex = 0
-
Mar 18th, 2001, 11:40 AM
#9
its worked for me, and I have the style set to '2' and every thing...
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 18th, 2001, 11:44 AM
#10
Thread Starter
Fanatic Member
it still doesn't work,
what could i have done to stop this working,
here is my code
Code:
Combo1.AddItem "sound 1"
Combo1.AddItem "sound 2"
Combo1.AddItem "sound 3"
Combo1.AddItem "sound 4"
Combo1.AddItem "sound 5"
'Code improved by vBulletin Tool (Save as...)
andi have the style set to 2, what am i doing wrong ??
Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
-- Linus Torvalds
[ Galahtech.com] | [ My Site] | [ Fishsponge] | [ UnixForum.co.uk]
-
Mar 18th, 2001, 12:04 PM
#11
Thread Starter
Fanatic Member
it ok one of my friends helped me with the problem, i had the code like this
Code:
Private Sub Form_Load()
Combo1.Text = Combo1.List(0)
Combo1.AddItem "sound 1"
Combo1.AddItem "sound 2"
Combo1.AddItem "sound 3"
Combo1.AddItem "sound 4"
Combo1.AddItem "sound 5"
End Sub
'Code improved by vBulletin Tool (Save as...)
instead of like this
Code:
Private Sub Form_Load()
Combo1.AddItem "sound 1"
Combo1.AddItem "sound 2"
Combo1.AddItem "sound 3"
Combo1.AddItem "sound 4"
Combo1.AddItem "sound 5"
Combo1.Text = Combo1.List(0)
End Sub
'Code improved by vBulletin Tool (Save as...)
thanks for all of your help and sorry for being a nuisance
Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
-- Linus Torvalds
[ Galahtech.com] | [ My Site] | [ Fishsponge] | [ UnixForum.co.uk]
-
Mar 18th, 2001, 12:32 PM
#12
Thread Starter
Fanatic Member
sorry to be a nuisance (again ) but once i have set the default combo item, i would like a way for the program to remeber what the last selection was so that next time the program is run it will have the last one selected as the option
e.g program runs for the 1st time and "sound 1" is default, the user decides that they like "sound 2" they select this one and close the program, when the program runs next instead of "sound 1 being default" "sound 2" should be.
sorry if this doesn't make sense, thanks for all of your help
Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
-- Linus Torvalds
[ Galahtech.com] | [ My Site] | [ Fishsponge] | [ UnixForum.co.uk]
-
Mar 18th, 2001, 12:35 PM
#13
makes sense enough, you can use a file or the registry to store the selected item when the app ends, then open the file/registry key and set it that way instead of hard-coding the 0 in there.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 18th, 2001, 12:37 PM
#14
Thread Starter
Fanatic Member
again sorry for being a pain, but do you have any code examples ??
Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
-- Linus Torvalds
[ Galahtech.com] | [ My Site] | [ Fishsponge] | [ UnixForum.co.uk]
-
Mar 18th, 2001, 12:41 PM
#15
i have never used the registry before, but here's a file example...
Code:
Private Sub Form_UnLoad()
Open app.Path & "\data.dat" For Output As #1
Print #1, Combo1.ListIndex
Close #1
End Sub
Private Sub Form_Load()
Dim Index As Integer
If Dir$(app.Path & "\data.dat") <> "" Then
Open app.Path & "\data.dat" For Input As #1
Input #1, Index
Close #1
Combo1.ListIndex = Index
End If
End Sub
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 18th, 2001, 12:45 PM
#16
Thread Starter
Fanatic Member
That is brilliant, thank you very much crptcblade for all of your help and time
Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
-- Linus Torvalds
[ Galahtech.com] | [ My Site] | [ Fishsponge] | [ UnixForum.co.uk]
-
Mar 18th, 2001, 12:49 PM
#17
no problem
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
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
|