Home All Groups Group Topic Archive Search About
Author
29 Mar 2005 7:04 PM
shoa
Hello all
I created a combo box with some values: "First name" and "Last name". I add
those values by using Data/Databinding/Items in the form. However, when I
run the application, the "First name" is not appeared in the form. I have to
click on the Combobox to get that value. What I want is that when I run the
application, the "First name" value should be appeared. Could you please
help
Thank you


In the generated code (Windows Form Designer generated code), I have:

Me.ComboBox1.Items.AddRange(New Object() {"First name", "Last name"})
Me.ComboBox1.Location = New System.Drawing.Point(120, 16)

Me.ComboBox1.Name = "ComboBox1"

Me.ComboBox1.Size = New System.Drawing.Size(100, 23)

Me.ComboBox1.TabIndex = 2

Author
29 Mar 2005 4:32 AM
MeltingPoint
Show quote Hide quote
"shoa" <s**@slingshot.co.nz> wrote in news:1112047555.794034@ftpsrv1:

> Hello all
> I created a combo box with some values: "First name" and "Last name".
> I add those values by using Data/Databinding/Items in the form.
> However, when I run the application, the "First name" is not appeared
> in the form. I have to click on the Combobox to get that value. What I
> want is that when I run the application, the "First name" value should
> be appeared. Could you please help
> Thank you
>
>
> In the generated code (Windows Form Designer generated code), I have:
>
>  Me.ComboBox1.Items.AddRange(New Object() {"First name", "Last name"})
> Me.ComboBox1.Location = New System.Drawing.Point(120, 16)
>
> Me.ComboBox1.Name = "ComboBox1"
>
> Me.ComboBox1.Size = New System.Drawing.Size(100, 23)
>
> Me.ComboBox1.TabIndex = 2
>
>
>

Try comboBox1.SelectedIndex = index


http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/cpref/html/frlrfsystemwindowsformscomboboxclassselectedindextopic.asp

MP
Author
29 Mar 2005 8:05 AM
Cor Ligthert
Shoa,


> I created a combo box with some values: "First name" and "Last name". I
> add
> those values by using Data/Databinding/Items in the form.

What do you mean with this sentence

> Me.ComboBox1.Items.AddRange(New Object() {"First name", "Last name"})

This set the first in your textbox to "First name" and the second item to
"Last Name" (When there is no databinding)

The rest of the instructions have not to do with the filling of the
combobox, so you make me curious what you want to achieve?

Cor
Author
30 Mar 2005 3:43 AM
john helen
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Author
29 Mar 2005 10:55 AM
Herfried K. Wagner [MVP]
"shoa" <s**@slingshot.co.nz> schrieb:
> Hello all

Please correct your system's time settings.  You are living in the future
;-).

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>