By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,694 Members | 1,288 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,694 IT Pros & Developers. It's quick & easy.

Need some Suggestions (Displaying Info from a Database)

P: n/a

I've got a little project going and I am trying to figure out a good
way to do this. But since I'm still learning I'm probably missing a
few obvious
steps. Also not sure if I have my logic right or not.

What I am trying to figure out is the process by which I pull the
information. I'm trying to populate a list box with items where
certain criteria are met.

The program is a tailoring program I wrote for star wars galaxies. I
am working on creating a custom outfit section where a user can
select various items of the outfit, for example shirt, pants, hat,
boots. Give it a label and then have it store that information to a

Then in the program we have a combo Box with an option for Outfits.
When the Outfits item is selected I'm trying to populate a List Box
with the name of the outfit. However when I do this it adds all of
the item names, but I only want it to display the item name once, and
then list the sub components in a second listbox. Each Sub Component
has its own set of values (resources it takes to make) which is
stored in a different table in the database.
So for example Lets say I have a database with the following in it.

The Code is a code given to an item, test name is the name of the item
and the component is something that the item is made up of.

Outfit_Code, Outfit_Name, Outfit_Component
1,Biker Outfit, Jacket
1, Biker Outfit, Helmet
2, Commando Outfit, Shirt
2, Commando Outfit, Vest
I need to figure out when someone selects the outfit option from the
combo box, how to loop it through the database and then add the
outfit name once, but then when selected display the components in it
in a second menu box. (Leaving this bit out for now till ready to
tackle it) Then have it open up another table and add up all of the
subcomponent items resources.

Anyone have any possible samples from other code or anything that
might be helpful. Perhaps some things to read that might get me
pointing on the right track. Or perhaps a different database

Owen :wink:

Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a

See this sample beneath this text what I made some days ago.

It are two listboxes, however that is almost the same.
To get the tables, you use normally a dataadapter, do you know that either,
do than tell that.

Normally I use forever datatables, however this person had a question about
arrays, so I integrated that in it..

It is complete to try.

I hope this helps?


\\\needs a form with 2 listboxes and one textbox
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim countries() As String = {"US", "EU"}
Dim table As New DataTable("Sample")
Dim dv As New DataView(table)
ListBox2.DataSource = dv
dv.Sort = "Name"
ListBox2.DisplayMember = "Name"
TextBox1.DataBindings.Add(New Binding("Text", dv, "Id"))
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender _
As Object, ByVal e As System.EventArgs) Handles
DirectCast(ListBox2.DataSource, DataView).RowFilter = _
"Country = '" & ListBox1.SelectedItem.ToString & "'"
End Sub
Private Sub CreateTable(ByVal Table As DataTable)
For i As Integer = 0 To 7
Dim dr As DataRow = Table.NewRow
dr(0) = i.ToString
Table.Rows(0)(1) = "Herfried K. Wagner"
Table.Rows(1)(1) = "Armin Zingler"
Table.Rows(2)(1) = "Ken Tucker"
Table.Rows(3)(1) = "CJ Taylor"
Table.Rows(4)(1) = "Jay B Harlow"
Table.Rows(5)(1) = "Terry Burns"
Table.Rows(6)(1) = "Tom Shelton"
Table.Rows(7)(1) = "Cor Ligthert"
Table.Rows(0)(2) = "EU"
Table.Rows(1)(2) = "EU"
Table.Rows(2)(2) = "US"
Table.Rows(3)(2) = "US"
Table.Rows(4)(2) = "US"
Table.Rows(5)(2) = "EU"
Table.Rows(6)(2) = "US"
Table.Rows(7)(2) = "EU"
End Sub

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.