comboBox invisible items?

skaryChinezeGuie

Well-known member
Joined
Apr 23, 2006
Messages
94
Programming Experience
Beginner
i have put 5 weapons in the combobox and when the form loads i want the items to be invisible unless they have been purchased. I will handle the purchase stuff i just need to know how to make them invisible. I was also thinking about just adding the items to the comboBox at the time of purchase. Whatever you think is easier. Whoever "you" is. Thanks.:D
 
ok here's what i'm thinkin. Show a messagebox with the string "Do you wanna purchase a knife?" and a yes and no button. If the yes button is clicked then (generic calculation and check for suff. funds), and add string "Knife" to combobox items.

don't worry about the (calculations).
 
VB.NET:
[SIZE=2][COLOR=#0000ff]Private [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] RadioButton1_CheckedChanged([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] RadioButton1.CheckedChanged
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] RadioButton1.Checked = [/SIZE][SIZE=2][COLOR=#0000ff]True [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff] If[/COLOR][/SIZE][SIZE=2] MessageBox.Show("Are you sure you want to buy " & RadioButton1.Tag & "?", "Confirmation", MessageBoxButtons.YesNo, _[/SIZE]
[SIZE=2]MessageBoxIcon.Question) = DialogResult.Yes [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]   If [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Not [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].ComboBox1.Items.Contains(RadioButton1.Tag) [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]      Me[/COLOR][/SIZE][SIZE=2].ComboBox1.Items.Add(RadioButton1.Tag)
[/SIZE][SIZE=2][COLOR=#0000ff]   Else
[/COLOR][/SIZE][SIZE=2]      MessageBox.Show("you already bought this weapon")
[/SIZE][SIZE=2][COLOR=#0000ff]   End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff] End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]

Just in case i attached the project so you can see from closer how it works ;)
 

Attachments

  • ComboBoxAddItemsAfterPurchase.zip
    25.2 KB · Views: 23
Back
Top