473,378 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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.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.
Sep 17 '08 #1
1 1350
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" <in**@rezten.euschreef in bericht
news:u1**************@TK2MSFTNGP04.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.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.


Sep 17 '08 #2

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

Similar topics

7
by: Marty | last post by:
Hi, Ok I use the OLEDBConnector and dataset to retrieve data from my Access DB. I have a problem to read/parse the dataset and I would like to know if I am using the right object to reach my...
0
by: Mark Schmidt | last post by:
Whilst coding away on a DataGrid and ComboBox I noticed the following behavior and want to know a) what it's called and b) what's going on internally within the framework. Basically, I did the...
6
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...
26
by: Lasse Edsvik | last post by:
Hello I'm trying to build a simple COM+ app in vs.net using C# and i cant register it in component manager..... what more is needed than this: using System; using...
2
by: jobi | last post by:
Hi, I have this combobox which has a table from a dataset as datasource. When I click an item on the combobox-list , I would like to display (in textfield) the value from an other column that...
5
by: Poonam | last post by:
I have a department table with DeptID and DeptName. I am trying to fill my combobox with DeptName. Here is my code but it does not work? Can someone help me? Dim pxy As New Channel1.Channel...
1
by: fiaolle | last post by:
Hi The first set of source code is the class for a combobox in a grid, hopefully. In the second set of code we try to use the combobox class, but the grid is empty. I don't understand how this...
1
by: webster1973 | last post by:
Hi ich habe ein Problem mit dem Datasource einer Combobox: ComboBox1.Datasource = Dataset.Tables.Item("Tabellenname") ComboBox1.DisplayMember = "Spalte1" ComboBox1.ValueMember = "Spalte2" ...
4
by: cwilliams01 | last post by:
Hello I am new to VB.NET, so sorry if this is really obvious. I have written the following code to fill my dataset from a stored procedure requiring 1 paramter input (from a SQL database). The...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.