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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Uli Netzer

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

    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.Table s("dtDomainName s")
    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.Sele ctionChangeComm itted
    strLDAPDomain = dtDomainNames.R ows.Item(CType( sender,
    ComboBox).Selec tedIndex).Item( "colString" )
    it works like a charm.


  • Cor Ligthert [MVP]

    #2
    Re: What's the difference... and DataSet as datasource for Combobox

    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


    "Uli Netzer" <info@rezten.eu schreef in bericht
    news:u1nAPiKGJH A.4992@TK2MSFTN GP04.phx.gbl...
    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.Table s("dtDomainName s")
    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.Sele ctionChangeComm itted
    strLDAPDomain = dtDomainNames.R ows.Item(CType( sender,
    ComboBox).Selec tedIndex).Item( "colString" )
    it works like a charm.
    >
    >

    Comment

    Working...