473,809 Members | 2,739 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with combobox

I posted this before but did some extra testing...

combobox with 3 elements (DropDownList style)
via code (button.click) I set the selectedIndex to -1
if element at index 0 is selected then everything is fine: nothing is
selected after pressing the button
but if element at index 1 or greater is selected and i press the button,
element at index 0 is selected (uncool)

i added a selectedindexch anged listener to my combobox
i can see it passes to index -1 and directly after that it passes again to
index 0

the result is the same in framework 1.0 and 1.1
anybody an idea?

testcode:
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim r As DataRow
Dim dt As DataTable
dt = New DataTable
dt.Columns.Add( "id")
dt.Columns.Add( "name")
dt.Rows.Add(New Object() {1, "one"})
dt.Rows.Add(New Object() {2, "toe"})
dt.Rows.Add(New Object() {3, "tie"})

ComboBox1.DataS ource = dt
ComboBox1.Displ ayMember = "name"
ComboBox1.Value Member = "id"
ComboBox1.Selec tedIndex = -1
End Sub

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
ComboBox1.Selec tedIndex = -1
End Sub

Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As Object, ByVal e
As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged
Debug.WriteLine (String.Format( "Selected index changed to [{0}]",
ComboBox1.Selec tedIndex))
End Sub
Nov 20 '05 #1
3 985
aha
found it...
http://support.microsoft.com/default...b;en-us;327244

is a known bug, but seems only to be known for 1.0...
i still have it in 1.1

"Dominique Vandensteen" <domi.vds_inser t@tralala_tenfo rce.com> wrote in
message news:eh******** ******@TK2MSFTN GP09.phx.gbl...
I posted this before but did some extra testing...

combobox with 3 elements (DropDownList style)
via code (button.click) I set the selectedIndex to -1
if element at index 0 is selected then everything is fine: nothing is
selected after pressing the button
but if element at index 1 or greater is selected and i press the button,
element at index 0 is selected (uncool)

i added a selectedindexch anged listener to my combobox
i can see it passes to index -1 and directly after that it passes again to
index 0

the result is the same in framework 1.0 and 1.1
anybody an idea?

testcode:
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim r As DataRow
Dim dt As DataTable
dt = New DataTable
dt.Columns.Add( "id")
dt.Columns.Add( "name")
dt.Rows.Add(New Object() {1, "one"})
dt.Rows.Add(New Object() {2, "toe"})
dt.Rows.Add(New Object() {3, "tie"})

ComboBox1.DataS ource = dt
ComboBox1.Displ ayMember = "name"
ComboBox1.Value Member = "id"
ComboBox1.Selec tedIndex = -1
End Sub

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
ComboBox1.Selec tedIndex = -1
End Sub

Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As Object, ByVal e
As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged
Debug.WriteLine (String.Format( "Selected index changed to [{0}]",
ComboBox1.Selec tedIndex))
End Sub

Nov 20 '05 #2
Cor
Hi Dominique,

Did you test the sample I have send to you,
Because that did work on 1.1
And I was curious if it also did work on 1.0

Cor

is a known bug, but seems only to be known for 1.0...
i still have it in 1.1

Nov 20 '05 #3
* "Dominique Vandensteen" <domi.vds_inser t@tralala_tenfo rce.com> scripsit:
I posted this before but did some extra testing...

combobox with 3 elements (DropDownList style)
via code (button.click) I set the selectedIndex to -1
if element at index 0 is selected then everything is fine: nothing is
selected after pressing the button
but if element at index 1 or greater is selected and i press the button,
element at index 0 is selected (uncool)


Maybe setting it to -1 twice will help.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2107
by: Kaneda | last post by:
Hello everyone! I have some weird(?) problems, and I am not quite sure if there are due to my errors or maybe a limitation in the .Net framework. I have a ComboBox I need to fill with the content of an untyped DataSet. This is to be done in the "DropDown" Event (since the dataset is empty at program start). If I go with this:
0
1160
by: Kaneda | last post by:
Hello everyone! I have some weird(?) problems, and I am not quite sure if there are due to my errors or maybe a limitation in the .Net framework. I have a ComboBox I need to fill with the content of an untyped DataSet. This is to be done in the "DropDown" Event (since the dataset is empty at program start). If I go with this:
6
7486
by: Omar | last post by:
When I try to databind my comboBox (specifically field "emplcode") to a filled dataset , the contents of the comboBox displays a bunch of "System.Data.DataRowView". I assume the amount of times "System.Data.DataR..." is displayed inside the combobox is the amount of records in the dataset. On the other hand, if my query is "select emplcode from payemployee", the databind will work fine (but I don't want to limit the dataset to one field)....
0
2178
by: Jax | last post by:
I am using a class that inherits from the DataGridTextBoxColumn. It adds a combo box into the column where it displays a selection of choices. The problem I have is that when this comboBox loses focus I lose the selected text. And this next line isn't setting the text in the cell. // code within the custom DataGridComboBoxColumn class this.TextBox.Text = this.ComboBox.SelectedItem.ToString();
3
6838
by: TT (Tom Tempelaere) | last post by:
Hay there, I'm writing my own DataGridComboBoxColumn because .NET 1.1 does not have one (I hope .NET 2.0 supplies one). I based it on this article: http://msdn.microsoft.com/msdnmag/issues/03/08/DataGrids/default.aspx I have a problem when there are two DataGrid's on one form, and when I switch focus from one grid to the other. To be more precise, when I'm editing a combo box column in one grid, and then click in the combo column of...
0
2383
by: tupolev | last post by:
Hi, I already post this item but now I know whats wrong: I want to allow the user to edit the items in a combobox. The problem is that the textchange event works just one time (for the first changed letter) because he reset the selectedindex of the combobox to -1. In debug mode I can't see where he does this. How can I solve this? My code sofar: contactlijst is a structure and the volgnummer is the index of the item in the combobox
30
4610
by: dbuchanan | last post by:
ComboBox databindng Problem == How the ComboBox is setup and used: My comboBox is populated by a lookup table. The ValueMember is the lookup table's Id and the DisplayMember is the text from a corresponding field in the lookup table. In my data table we store the ID in what I will call the 'key' field. == Description of the desired operation:
1
2075
by: amber | last post by:
I'm having an issue with a combobox that is making no sense to me at all. I have a form with several comboboxes/textboxes. The values in these boxes are based on a datarowview, which is based on a listbox.selecteditem. When a different item is selected in the listbox, all the fields are repopulated with the correct data. I have 1 combobox which is acting weird.
1
4120
by: Aleksey Timonin | last post by:
Hi guys, I have a comboBox binded to DataTable: comboBox.DataSource = MyDataTable; comboBox.ValueMember = "id"; comboBox.DisplayMember = "id";
6
2941
by: RamonPV | last post by:
Hello: I am having a problem with to linked comboxes in IE7. Here is my problem that is ONLY ocurring in IE7: I have javascripts functions to populate the second of 2 comboxes given the selected option on the first one; the scripts look to be ok since they work perfectly on firefox 3.08 and also on IE6 and IE8; I have inspected the generated combobox options code using firebug extension on firefox and they are ok; on IE7 the options for the...
0
9722
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10643
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10378
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10391
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.