What's the difference... and DataSet as datasource for Combobox

U

Uli Netzer

between Dim strXYZ() as String
and Dim strXYZ as String()

It doesn't seem to make a difference in the way I use the variable.


Another problem I have.
I load three variables with 3 values each which then get loaded into a
datatable with 3 columns. This datatable is then the datasource from a
combobox. This works fine until I choose another index of the combobox and
want to switch back to the 0 index. It won't let me. It seems to stick to
the second index (1)

Dim strNames() As String = {"domain 1", "domain 2", "domain 3"}
Dim strString() As String = {LDAP://domain 1, LDAP://domain 2, LDAP://domain
3}
Dim strDomain() As String = {"domain 1.com", "domain 2.com", "domain 3.com"}
Dim i As Int16
Dim dr As Data.DataRow

Try
dt = dsDomains.Tables("dtDomainNames")
For i = 0 To strNames.Length - 1
dr = dt.NewRow()
dr("colName") = strNames(i)
dr("colString") = strString(i)
dr("colDomain") = strDomain(i)
dt.Rows.Add(dr)
Next

....

If I remove the datasource and just add the items (strNames) and call the
following on cboDomains.SelectionChangeCommitted
strLDAPDomain = dtDomainNames.Rows.Item(CType(sender,
ComboBox).SelectedIndex).Item("colString")
it works like a charm.
 
C

Cor Ligthert [MVP]

Uli,

Please make next time for every question a seperate post.

There is no difference at all for defining an array as you set it at the
name or at the type.

A combobox is a dropdown, that combines the possibility to connect it to a
Data Object or to be used to show an array of items.

However it is not combining a kind of mix from that.

Cor
 

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