Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Dynamic Combobox

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Euzinho Dassilva
Advanced Cheater
Reputation: 0

Joined: 08 Sep 2007
Posts: 62

PostPosted: Tue Oct 09, 2007 11:15 am    Post subject: Dynamic Combobox Reply with quote

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
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Tue Oct 09, 2007 5:37 pm    Post subject: Reply with quote

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
View user's profile Send private message
Euzinho Dassilva
Advanced Cheater
Reputation: 0

Joined: 08 Sep 2007
Posts: 62

PostPosted: Wed Oct 10, 2007 5:13 am    Post subject: Reply with quote

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 Razz

To Remove
Code:
Me.listNormalShops.Items.Remove(Falconreach)


Don't work Sad

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 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
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites