Reputation: 863
I'm working with a combox and datagridview. What I am trying to accomplish (this is homework) is show a combobox where the user can pick an employee ID. When the user chooses that ID the datagrid view displays sales for that employee's ID.
I am coming up with all kinds of issues so I would like to restart and walk through the process. My form is fairly simple. Here is what I have done so far, please bear with me.
First I set my employeeID to a combobox (from the datasource on the datasources pane) and dragged and dropped to my form. I clicked and set it to use databound items and set it to the same datasource as my datagrid view. Then I chose EmployeeID for my display member.
The datagrid view will load just fine and brings up every order. The employeeID combobox will load several ID's and there are duplicates because an ID can be associated with seperate orders. If I pick an ID it isolates the order that ID is associated with. This is where I am stuck.
I don't have much code to show because of the way this was programmed (drag and drop) but I can show you what came up:
Public Class EmployeeOrdersForm
Private Sub EmployeeOrdersForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'NORTHWNDDataSet.Employees' table. You can move, or remove it, as needed.
Me.EmployeesTableAdapter.Fill(Me.NORTHWNDDataSet.Employees)
'TODO: This line of code loads data into the 'NORTHWNDDataSet.Employees' table. You can move, or remove it, as needed.
Me.EmployeesTableAdapter.Fill(Me.NORTHWNDDataSet.Employees)
'TODO: This line of code loads data into the 'NORTHWNDDataSet.Employees' table. You can move, or remove it, as needed.
Me.EmployeesTableAdapter.Fill(Me.NORTHWNDDataSet.Employees)
'TODO: This line of code loads data into the 'NORTHWNDDataSet.Order_Details' table. You can move, or remove it, as needed.
Me.OrdersTableAdapter.Fill(Me.NORTHWNDDataSet.Orders)
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
End Sub
Private Sub EmployeeIDComboBoxToolStripLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
End Class
Can someone point me in the right direction? Is it possible to sort the combobox so that way I can have it only display the employeeID once and then when clicked sort through the orders?
Thank you,
J
Upvotes: 0
Views: 752
Reputation: 863
THis isnt the official answer but I was able to find a walk through in the book. It still has errors but I guess it's better than nothing.
Upvotes: 0