|
-
Apr 12th, 2008, 09:45 AM
#1
Re: [2005] List1 selected items
Add these debug statements.
Code:
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
debug.writeline (ComboBox1.SelectedItem)
If ComboBox1.SelectedItem = "Item1" Then
...
End Sub
Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
debug.writeline (ComboBox1.SelectedItem)
If ComboBox1.SelectedItem = "Item2" Then 'ComboBox1?????
...
End Sub
Also, what is List1?
Last edited by dbasnett; Apr 12th, 2008 at 09:48 AM.
-
Apr 12th, 2008, 10:16 AM
#2
Thread Starter
Banned
Re: [2005] List1 selected items
List1 is a listbox, where I want to have relate with combobox1 and combobox2, also I have forgot to included with button1 where I am trying to have relationship with them. I have trouble with the loop that when I selected the item on combobox1 "Item1" and I click on button1, I make the items clear on list1 and add the items again which the selected index on list1 stay on the first item to selected so when I selected the second item on combobox2 "Item2" and click the button, the selected index on list1 should have stay on the second item but they return to the first item on list1. I am trying to block the loop in order to stop them getting pass in each of those lines but there are no way that I can do to get it working out.
Here it the code:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Me.ComboBox1.SelectedItem = "Item1" Then
List1.Items.Clear()
List1.Items.Add(My.Resources.RuntimeStrings_test.1)
List1.Items.Add(My.Resources.RuntimeStrings_test.2)
ListBox1.SelectedIndex = 0
End If
If Me.ComboBox2.SelectedItem = "Item2" Then
ListBox1.SelectedIndex = 1
End If
Me.Button1.Enabled = False
End Sub
You can see two different combobox between 1 and 2 at the end, also it included with ListBox1.SelectedIndex. I have tried hundred of times to find a way to get the loop to blocking but they keep passing in each of those lines and do the wrong things.
Hope you can help me as I tried to block the loops but it didn't work for me out that way.
Thanks,
Mark
-
Apr 12th, 2008, 10:52 AM
#3
Re: [2005] List1 selected items
After this line
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
add these
debug.writeline (ComboBox1.SelectedItem)
debug.writeline (ComboBox2.SelectedItem)
run your code and then tell me the output from the immediate window (where the debug output is).
One time I look at your code and it is in one handler, then it is in another handler. Let's go slow, a few changes at a time.
Your english is better than my (whatever your native language is), but you are very, very, very, hard to understand.
Last edited by dbasnett; Apr 12th, 2008 at 11:01 AM.
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
|