Invisible combobox.

G

Guest

I set up a combobox with Visual Studio 2003 and it generated the following
code:

//
// serverComboBox
//
this.serverComboBox.DropDownWidth = 121;
this.serverComboBox.Items.AddRange(new object[] {
"AllServers",
"1Server",
"2Server",
"3Server"});
this.serverComboBox.Location = new System.Drawing.Point(136, 16);
this.serverComboBox.Name = "serverComboBox";
this.serverComboBox.Size = new System.Drawing.Size(121, 21);
this.serverComboBox.TabIndex = 0;

The problem is that the items are not displayed in the drop down. If I
select the second item then the combo box text seems to get set to the right
value (in this case "1Server" but I don't see any of the items that I am to
select until it is selected and the combo box text is set to the selection.
How can I enable the viewing of the combo box items?

Thank you.

Kevin
 
R

Ron

Kevin Burton said:
I set up a combobox with Visual Studio 2003 and it generated the following
code:

//
// serverComboBox
//
this.serverComboBox.DropDownWidth = 121;
this.serverComboBox.Items.AddRange(new object[] {
"AllServers",
"1Server",
"2Server",
"3Server"});
this.serverComboBox.Location = new System.Drawing.Point(136, 16);
this.serverComboBox.Name = "serverComboBox";
this.serverComboBox.Size = new System.Drawing.Size(121, 21);
this.serverComboBox.TabIndex = 0;

The problem is that the items are not displayed in the drop down. If I
select the second item then the combo box text seems to get set to the
right
value (in this case "1Server" but I don't see any of the items that I am
to
select until it is selected and the combo box text is set to the
selection.
How can I enable the viewing of the combo box items?
<snip>
Hi Kevin.
I am not sure why you are setting the TabIndex.
Your code works when I add this line:

this.serverComboBox.SelectedIndex = 0;


HTH
Ron.
 
G

Guest

I am not setting the tab index. Like I said this code was auto generated by
Visual Studio .NET 2003.

Thank you for the tip. I will try it.

Kevin

Ron said:
Kevin Burton said:
I set up a combobox with Visual Studio 2003 and it generated the following
code:

//
// serverComboBox
//
this.serverComboBox.DropDownWidth = 121;
this.serverComboBox.Items.AddRange(new object[] {
"AllServers",
"1Server",
"2Server",
"3Server"});
this.serverComboBox.Location = new System.Drawing.Point(136, 16);
this.serverComboBox.Name = "serverComboBox";
this.serverComboBox.Size = new System.Drawing.Size(121, 21);
this.serverComboBox.TabIndex = 0;

The problem is that the items are not displayed in the drop down. If I
select the second item then the combo box text seems to get set to the
right
value (in this case "1Server" but I don't see any of the items that I am
to
select until it is selected and the combo box text is set to the
selection.
How can I enable the viewing of the combo box items?
<snip>
Hi Kevin.
I am not sure why you are setting the TabIndex.
Your code works when I add this line:

this.serverComboBox.SelectedIndex = 0;


HTH
Ron.
 
G

Guest

Thank you for your help. For the record this did not solve the problem. I am
hoping that another response indicating that my virus scanner is at fault my
resolve the issue. Thanks again.

Kevin

Ron said:
Kevin Burton said:
I set up a combobox with Visual Studio 2003 and it generated the following
code:

//
// serverComboBox
//
this.serverComboBox.DropDownWidth = 121;
this.serverComboBox.Items.AddRange(new object[] {
"AllServers",
"1Server",
"2Server",
"3Server"});
this.serverComboBox.Location = new System.Drawing.Point(136, 16);
this.serverComboBox.Name = "serverComboBox";
this.serverComboBox.Size = new System.Drawing.Size(121, 21);
this.serverComboBox.TabIndex = 0;

The problem is that the items are not displayed in the drop down. If I
select the second item then the combo box text seems to get set to the
right
value (in this case "1Server" but I don't see any of the items that I am
to
select until it is selected and the combo box text is set to the
selection.
How can I enable the viewing of the combo box items?
<snip>
Hi Kevin.
I am not sure why you are setting the TabIndex.
Your code works when I add this line:

this.serverComboBox.SelectedIndex = 0;


HTH
Ron.
 
H

Herfried K. Wagner [MVP]

Kevin Burton said:
I set up a combobox with Visual Studio 2003 and it generated the following
code:

//
// serverComboBox
//
this.serverComboBox.DropDownWidth = 121;
this.serverComboBox.Items.AddRange(new object[] {
"AllServers",
"1Server",
"2Server",
"3Server"});
this.serverComboBox.Location = new System.Drawing.Point(136, 16);
this.serverComboBox.Name = "serverComboBox";
this.serverComboBox.Size = new System.Drawing.Size(121, 21);
this.serverComboBox.TabIndex = 0;

The problem is that the items are not displayed in the drop down. If I
select the second item then the combo box text seems to get set to the
right
value (in this case "1Server" but I don't see any of the items that I am
to
select until it is selected and the combo box text is set to the
selection.

Fixing the problem of missing text in controls and messageboxes
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=controlsmissingtextbug&lang=en>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top