473,883 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populate ComboBox based on selection of another ComboxBox

ROO
Hi Everyone,
I have a database table that have 4 field( C1, C2,
M1, M2) on my form i have two combo box ComboC and ComboM

C1 C2 M1
M2
1 Sales 1
Monthly Terms
1 Sales 2
Annual Terms
1 Sales 3
Yearly Terms
2 Tech 1
Windows
2 Tech 2
Linux
2 Tech 3
Mac

I write a procedure that populate ComboC with a Combine distinct info from
the table(C1 ' ' + ' ' + C2) and When you Select any item from ComboC it
populates ComboM with the List of item in (M1 ' ' + ' ' + M2) in other words
if you select Sales in ComboC it should populate ComboM with Monthly Teems,
Annual Terms and Year Terms

It have the code that populate the comboxC below, I need help with the
procedure that will populate ComboM based on selection of comboxC

Dim mySqlConnection As SqlConnection
mySqlConnection = New
SqlConnection(S ystem.Configura tion.Configurat ionSettings.App Settings.Get("C o
nnectionString" ))
mySqlConnection .Open()
Dim Dt As DataTable
Dim Ds As New DataSet
Dim StrSql As String
StrSql = "SELECT Distinct ClientNumber + ' ' + ' ' + ClientName as
MyClients, ClientNumber as ClientID FROM ClientMatter"
Dim Da As New SqlDataAdapter( StrSql, mySqlConnection )
Da.Fill(Ds)
_dtClient = Ds.Tables(0)
Try
cmbClient.Value Member = "ClientID"
cmbClient.Displ ayMember = "MyClients"
cmbClient.DataS ource = _dtClient.Defau ltView
Catch ex As Exception
MsgBox(ex.Messa ge.ToString)
End Try
mySqlConnection .Close()

Thanks
ROO
Nov 21 '05 #1
0 2142

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

Similar topics

1
1977
by: Steve | last post by:
I have a continuous form with several unbound comboboxes in the form header. The comboboxes are used to provide criteria for the SQL of the form. The code behind the form looks like: Public Sub FormSQL() Dim SQLStr As String SQLStr = < Code to build SQL String based on selection in comboboxes> SQLStr = SQLStr & ";" Me.RecordSource = SQLStr End Sub
2
4538
by: ross kerr | last post by:
Hi all, I have a control that extends the ComboBox object. It updates the selected item based on what the user enters in the text area. In the OnLeave event of the combobox, the selected index is set to the proper item. However, when accessing its selectedindex later it has reverted to the previous value. The selectedindex value is always one behind what
3
1664
by: Alonso | last post by:
Hi, I have two drop downs and the content of the second one must changed everytime the user changes the selection in the first one. Is any easy way of doing this? Thanks in advance. Alonso
14
3668
by: Barney | last post by:
How can I populate a textbox from a dataview? I have a dataset i'm filtering on and i want to populate several textboxes based on that filter. How can i get that to work? I've tried: dsDetails = GetCars() dvDetails = New DataView With dvDetails
0
1274
by: SimpDogg | last post by:
Hey guys another Newbie here... I have a combobox(JobName) on my form tied to a table named (Jobs) with one field for all of the jobs in the comboxbox. I want to auto populate the Due Out Date on the form based off the job selection. The only thing I could come up with is this If .Value = "EZ0032" Then + 4 ElseIf .Value = "EZ0840" Then
2
3327
by: Ronald | last post by:
I hope somebody can help. I can't get into the specifics of my project, but I'll try to create a simple example: tblVehicle * VIN (text box) * Make (text box) * Model (text box) frmRepair
3
1983
rohitrohitrohit
by: rohitrohitrohit | last post by:
new to php..... i hav a login page? after validaing loginname and password second page comes...... i access his loginname through url which is ->http://localhost/aa/vtr/add/add_ps2.php?name=div,in second page i hav three combobox (unit,achivements,crop) these comboxbox dynamically fill values from mysql database depends on loginname but when i am selecting unit comboxbox value browser url changed to http://localhost/aa/vtr/add/add_ps2.php ...
1
2317
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
This actually stemmed from anther post I created. But, I have two combo boxes. ComboBox1 is populated by a list of Systems (DataSet from Oracle Query). Now, I want to take Combobox2, and when the data is changed on Combox1, I want to populate data depending on the selection in Combox1. So, ComboBox1 lists "OracleDB123". I want ComboBox2 to list all accounts on that system. That information is stored in say the Accounts
1
2478
by: Rosie | last post by:
I have a main form with header info w/ 'tHeader' as the control source. I have a subform with 'tDetail' as a control source. They're strung together by a field named MA_ID. This works fine. I have a field within the subform that I want to update via a combobox located on the same subform.
0
9778
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10730
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9559
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7959
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7114
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5784
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5980
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4205
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3228
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.