473,387 Members | 1,891 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,387 software developers and data experts.

Filling a combobox from MTGC with data from a datatable

I have found a good combobox with multiple fields
The example shows filling the combobox from a listview, but I want to fill
it with zip-code and cities from a database.
The example is as follows:
Dim dtLoading As New DataTable("UsStates")

dtLoading.Columns.Add("Name", System.Type.GetType("System.String"))

dtLoading.Columns.Add("Abbreviation", System.Type.GetType("System.String"))

dtLoading.Columns.Add("Population", System.Type.GetType("System.String"))

dtLoading.Columns.Add("Size", System.Type.GetType("System.String"))

For Each li As ListViewItem In lsvData.Items

Dim dr As DataRow

dr = dtLoading.NewRow

dr("Name") = li.Text

dr("Abbreviation") = li.SubItems(1).Text

dr("Population") = li.SubItems(2).Text

dr("Size") = li.SubItems(3).Text

dtLoading.Rows.Add(dr)

Next

comboTest.SelectedIndex = -1

comboTest.Items.Clear()

comboTest.LoadingType = MTGCComboBox.CaricamentoCombo.DataTable

comboTest.SourceDataString = New String(3) {"Name", "Abbreviation",
"Population", "Size"}

comboTest.SourceDataTable = dtLoading

MsgBox("Loading completed!", MsgBoxStyle.Information)

How can I make the source a datatable instead of the listview

regards

reidarT


Nov 21 '05 #1
4 4760
Reidar,

The combobox is filled from a datatable (part of a dataset)
comboTest.SelectedIndex = -1
comboTest.Items.Clear()
comboTest.LoadingType = MTGCComboBox.CaricamentoCombo.DataTable
comboTest.SourceDataString = New String(3) {"Name", "Abbreviation",
"Population", "Size"}
comboTest.SourceDataTable = dtLoading
MsgBox("Loading completed!", MsgBoxStyle.Information)


Probably it is
comboTest.LoadingType = mydataset.tables(0)

Can you give us the link to this combo?

Cor
Nov 21 '05 #2
Reidar,

The combobox is filled from a datatable (part of a dataset)
comboTest.SelectedIndex = -1
comboTest.Items.Clear()
comboTest.LoadingType = MTGCComboBox.CaricamentoCombo.DataTable
comboTest.SourceDataString = New String(3) {"Name", "Abbreviation",
"Population", "Size"}
comboTest.SourceDataTable = dtLoading
MsgBox("Loading completed!", MsgBoxStyle.Information)


Probably it is
comboTest.LoadingType = mydataset.tables(0)

Can you give us the link to this combo?

Cor
Nov 21 '05 #3
The link is
http://www.mtgc.net/
regards
reidarT

"Cor Ligthert" <no************@planet.nl> skrev i melding
news:ut*************@TK2MSFTNGP12.phx.gbl...
Reidar,

The combobox is filled from a datatable (part of a dataset)
comboTest.SelectedIndex = -1
comboTest.Items.Clear()
comboTest.LoadingType = MTGCComboBox.CaricamentoCombo.DataTable
comboTest.SourceDataString = New String(3) {"Name", "Abbreviation",
"Population", "Size"}
comboTest.SourceDataTable = dtLoading
MsgBox("Loading completed!", MsgBoxStyle.Information)


Probably it is
comboTest.LoadingType = mydataset.tables(0)

Can you give us the link to this combo?

Cor

Nov 21 '05 #4
Reidar,

Looks nice I think that Pieter will be fond of this one. Do you have it
running now?

Cor
Nov 21 '05 #5

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

Similar topics

0
by: Doug | last post by:
This is a repost of an item that I still cannot resolve. I have 3 combo boxes. The first leads to the second to the third. When I have selected a value in the second box, the third box shows...
5
by: Claudio Di Flumeri | last post by:
Hi all, Iive found this bug int the VB combobox and I'd like to know if there is a way to solve it... Put a combobox in a form, and fill it with these 3 items: - athens - berlin - chicago ...
0
by: reidarT | last post by:
I have found a good combobox with multiple fields The example shows filling the combobox from a listview, but I want to fill it with zip-code and cities from a database. The example is as follows:...
30
by: dbuchanan | last post by:
ComboBox databindng Problem == How the ComboBox is setup and used: My comboBox is populated by a lookup table. The ValueMember is the lookup table's Id and the DisplayMember is the text from a...
7
by: Simon Verona | last post by:
I posted this in dotnet.languages.vb.controls but thought I'd post here as well.. I have a combobox that is bound to a dataview generated from a dataset. The dataset has a single table...
3
by: sklett | last post by:
I'm changing from a DataGrid to a DataGridView and have run across a problem. The items that are bound to the DataGrid have an int Property that represents a primary key of a lookup table in my...
8
by: kimtherkelsen | last post by:
Hi, I do this: this.comboBox.DataSource = myDataSet.Tables.Select("location_key = " + selectedLocationKey); this.comboBox.DisplayMember = "text"; this.comboBox.ValueMember =...
3
by: Scott2112 | last post by:
Hello, I have a simple datatable ("Co_Size")with non-unique data and I would like to populate a combobox with unique data (VB 2005). I haven't figured it out yet. Any help? Scott
2
by: kurtzky | last post by:
i created a form that should function as follows: i will enter a number in a textbox..then it should query from the database all the records which has that number..these records will have a...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.