Help me with Datagrid Problem

Dec 15 2003 8:10 AM
Hi All I have two Tables in my MSSQL Db called Kategori and Produkt the kategoriID is a foreign key in the Produkt table. I am developing a Window based user interface to connect to the db. I have a listbox and a Datagrid the ListBox is populated with Product names and the column is ProduktNavn. What I trying to achieve is that when I click on any of the product name in the ListBox the information regarding the specific product like price and totalInstock and stuff like that to be placed automatically in the datagrid Here is my select query strsql = "select Produktid, ProduktNavn,PrisPerKg, AntallPåLager,AntallPåBestilling from Produkt where Kategoriid= (select kategoriId from kategori where kategori='" & kategori & "')" and in the selected indexChange in the ListBox I have this code placed under Private Sub lbovelgKategori_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbovelgKategori.SelectedIndexChanged Dim dsgrid As DataSet dsgrid = db.hentProdukt(lbovelgKategori.SelectedIndex) Me.lbovelgKategori.DisplayMember = "Produktid" Me.lbovelgKategori.DisplayMember = "ProduktNavn" Me.lbovelgKategori.DisplayMember = "PrisPerKg" Me.lbovelgKategori.DisplayMember = "AntallPåLager" Me.lbovelgKategori.DisplayMember = "AntallPåBestilling" dgbestilling.DataSource = (dsgrid.Tables(0)) Me.lbovelgKategori.SelectedItem = dgbestilling.Text End Sub When I run the application the Header for the column names are placed on the Datagrid as specified in my select query, but when I click on any of the items or products the ListBox nothing happen. Can somebody help me Please If you have alternative solution I will welcome your Idea Thanks in advance