 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Euzinho Dassilva Advanced Cheater
Reputation: 0
Joined: 08 Sep 2007 Posts: 62
|
Posted: Tue Oct 09, 2007 11:15 am Post subject: Dynamic Combobox |
|
|
Hi (again)
How can I make a dynamic combobox in VB 2008 Express like in JavaScript.
Example:
Combobox #1
---- Value One
---- Value Two
If value of Combobox #1 it's "Value One", the second combobox it's "auto-populated" with, for example A, B, C options
If value of Combobox #1 it's "Value Two", the second combobox it's "auto-populated" with, for example X, Y, Z options
And it's continues ...
[EDIT]
I make a test with
Code: | Private Sub listTowns_SelectedValueChanged1(ByVal sender As Object, ByVal e As System.EventArgs) Handles listTowns.SelectedValueChanged
If (listTowns.SelectedItem = "Falconreach") Then
'Populate Normal Shop
Me.listNormalShops.Text = ""
Me.listNormalShops.Items.AddRange(New Object() {"x", "y", "z"})
'Populate Merge Shop
Me.listMergeShops.Text = ""
Me.listMergeShops.Items.AddRange(New Object() {"x", "y", "z"})
End If
If (listTowns.SelectedItem = "Oaklore") Then
'Populate Normal Shop
Me.listNormalShops.Text = ""
Me.listNormalShops.Items.AddRange(New Object() {"x", "y", "z"})
'Populate Merge Shop
Me.listMergeShops.Text = ""
Me.listMergeShops.Items.AddRange(New Object() {"x", "y", "z"})
End If
If (listTowns.SelectedItem = "Amityvale") Then
'Populate Normal Shop
Me.listNormalShops.Text = ""
Me.listNormalShops.Items.AddRange(New Object() {"x", "y", "z"})
'Populate Merge Shop
Me.listMergeShops.Text = ""
Me.listMergeShops.Items.AddRange(New Object() {"x", "y", "z"})
End If
If (listTowns.SelectedItem = "Osprey Cove") Then
'Populate Normal Shop
Me.listNormalShops.Text = ""
Me.listNormalShops.Items.AddRange(New Object() {"a", "b", "c"})
'Populate Merge Shop
Me.listMergeShops.Text = ""
Me.listMergeShops.Items.AddRange(New Object() {"a", "b", "c"})
End If
End Sub |
And works fine, except by the fact that the value area cloned (it's correct?).
Example:
I select, in this case in the first combo the "Falconreach" option. The second and the third combo's are populated fine. But if I choose another value in the first combo, the "pre-existent" value in the second and third menu don't disappear.
|
|
Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Tue Oct 09, 2007 5:37 pm Post subject: |
|
|
I personally don't use VB because I believe it is horrible. But to answer your question I am going to have to say this:
You probably have to remove the previous modifications to the combobox before adding any new ones.
|
|
Back to top |
|
 |
Euzinho Dassilva Advanced Cheater
Reputation: 0
Joined: 08 Sep 2007 Posts: 62
|
Posted: Wed Oct 10, 2007 5:13 am Post subject: |
|
|
Yeh, I need exactly this.
But I don't know how can I remove value in loop
Look my changes:
Desired value for second combobox was stored ina variable
Code: | Dim Falconreach As Object() = New Object() {"a", "b", "c"} |
To use
Code: | Me.listNormalShops.Items.AddRange(Falconreach) |
Works Fine
To Remove
Code: | Me.listNormalShops.Items.Remove(Falconreach) |
Don't work
But, in the last code, if I change Falconreach for/by (i don't know) a, b, c or any value. Works.
I need to execute this code in a object loop, because, for this DragonFable Trainer, the list (of Shops) it's so long.
[EDIT]
Yeeehhhh!!! Now works fine. The problem in empty combobox was resolved with Clear() method.
Thanks to source code of DragonFable Hallowen Trainer, made by SCRN
|
|
Back to top |
|
 |
|
|
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 You cannot attach files in this forum You can download files in this forum
|
|