Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
|
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 9th, 2005, 02:08 PM
Authorized User
 
Join Date: Dec 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hemanth_p2p
Default Restricting the data in a ComboBox

Hi,
 Here is the problem:
  I have two ComboBox's. I am trying to do a drill down based on the selection of each box. For example, I get the data for CB1 from the database and fill it.If CB1 is let's say..project_id and I select one project_id, I want CB2 to be filled with Group_id's for that project. Finally after all the selection's are made I want the data of Group_Id selected in CB2 to be displayed in a DataGrid.
 Here is what I did:
  I tried passing the parameter in Fill(), but for some reason I do not get any data. I am using a SQL Server2000 DB.

I am still stuck at the first step:(

Thanking you in anticipation for a solution :D

----

Distributed computing ->Causality-> EventDriven ->We have the last laugh.!!
__________________
----

Distributed computing ->Causality-> EventDriven ->We have the last laugh.!!
 
Old January 9th, 2006, 04:11 PM
Registered User
 
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have half of the solution to your problem. I'm hardtime to get the valuemember of my second box. The code is in VB with Acces DB.
"
 Dim ds As New DataSet
        Dim cmdString As String = "select * from project"
        Dim da As New OleDb.OleDbDataAdapter(cmdString, con)
        da.Fill(ds, "project")

        cmdString = " select * from group"
        da = New OleDb.OleDbDataAdapter(cmdString, con)
        da.Fill(ds, "group")

        Dim relation As New DataRelation("ProjectGroup", _
                    ds.Tables("project").Columns("project_ID"), _
                    ds.Tables("group").Columns("project_ID") _
                    )
        ds.Relations.Add(relation)

        cb1.DataSource = ds
        cbOrg.DisplayMember = "tblProjectGroup.ProjectGroup_Name"
        cbOrg.ValueMember = "tblProjectGroup.ProjectGroup_ID"

        cbAccount.DataSource = ds
        cbAccount.DisplayMember = "tblProjectGroup.ProjectGroup.Group_name"
        cbAccount.ValueMember = "tblProjectGroup.ProjectGroup.Group_ID"

"
I hope this will help you....

 
Old January 10th, 2006, 02:23 AM
Authorized User
 
Join Date: Dec 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hemanth_p2p
Default

Thank you! that looks promising. Let me try it and see if i can get the data into the second one as well


----

Distributed computing ->Causality-> EventDriven ->We have the last laugh.!!





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to fill the combobox with data from different alfiecrosby General .NET 0 May 14th, 2008 10:54 AM
Data in combobox sathishr Excel VBA 1 January 2nd, 2007 06:35 AM
data filtering from combobox MAKO C# 4 June 1st, 2006 03:54 AM
data binding a combobox ozPATT Excel VBA 1 November 16th, 2005 08:17 AM
ComboBox with Data from More than 1 Table rocknrisk Access 7 August 19th, 2005 02:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.