| | |
Need some help with a comboBox control
![]() |
•
•
Join Date: Jan 2007
Posts: 11
Reputation:
Solved Threads: 0
I'm pretty new to C# programming and .NET programming however I have a great deal of experience with database & programming in the world of Unix,PHP,Perl, Javascript. I've been learning C# database programming with a WROX book but it doesn't tell you everything and unfortunately I need a little hand holding right now.
Well I'm working on my training application as I call it. It has two tables CLIENT and EMPLOYEE with client having a foreign key to employee. The key lets you know which employee helped which client last.
I have a Form that lays out the CLIENT information in List view and I want the "lasted helped by" field to be a combo box displaying the last employee who helped the client with the option to change the value via the combo box. I'm able to bind the box to the data source for the available EMPLOYEES but it doesn't seem to work in terms of showing the foreign key value. I know I'm missing something or doing something wrong but don't know where to look for more information on the subject. Could someone make a suggestion?
I suspect that binding may not be an option since I want the combo to drop down to <lastname, firstname> values while updating in the background to a numeric key value.
Well I'm working on my training application as I call it. It has two tables CLIENT and EMPLOYEE with client having a foreign key to employee. The key lets you know which employee helped which client last.
I have a Form that lays out the CLIENT information in List view and I want the "lasted helped by" field to be a combo box displaying the last employee who helped the client with the option to change the value via the combo box. I'm able to bind the box to the data source for the available EMPLOYEES but it doesn't seem to work in terms of showing the foreign key value. I know I'm missing something or doing something wrong but don't know where to look for more information on the subject. Could someone make a suggestion?
I suspect that binding may not be an option since I want the combo to drop down to <lastname, firstname> values while updating in the background to a numeric key value.
Just a guess but it sounds like you may have built a data source which only represents the clients table, you can manually create a sql statement to join the clients table to the employees table on the foreign key employee id, then i think your binding should work. Although typed datasets are good for some situations they are mostly a good quick and dirty fix for non complex tables, if you want real flexibility I would suggest building your owwn objects/data layer and writing stored procedures to get the data in the format you'd like
•
•
Join Date: Jan 2007
Posts: 11
Reputation:
Solved Threads: 0
Hi sedguy,
Good to hear your guess especially since its what I've thought of in the last 24 hours. I've basically been reading another C# 2005 development book I picked up trying to figure out where I need to stop dragging, dropping and configuring and start programming my own procedures. The input is very much appreciated. Thanks
-Jerry
Good to hear your guess especially since its what I've thought of in the last 24 hours. I've basically been reading another C# 2005 development book I picked up trying to figure out where I need to stop dragging, dropping and configuring and start programming my own procedures. The input is very much appreciated. Thanks
-Jerry
Not a problem, let me know if you have any other questions, I sometimes use this to speed up the object generation process:
http://www.eggheadcafe.com/articles/..._generator.asp
it's cool if you already have an existing database as it builds objects for each of the tables and procedures to add/delete/update them. It works using generics (new for C# 2.0) although beware, as it doesnt handle primary key identities very well (when it creates the add procedures and objects it allows the primary key to be writable) although it's easily tweaked.
I'd suggest doing ot the hard way first though as then you'll find it easy to modify the generated code
http://www.eggheadcafe.com/articles/..._generator.asp
it's cool if you already have an existing database as it builds objects for each of the tables and procedures to add/delete/update them. It works using generics (new for C# 2.0) although beware, as it doesnt handle primary key identities very well (when it creates the add procedures and objects it allows the primary key to be writable) although it's easily tweaked.
I'd suggest doing ot the hard way first though as then you'll find it easy to modify the generated code
![]() |
Similar Threads
- combobox control (VB.NET)
- return a value from javascript (PHP)
- about ComboBox problem (C)
- Issue related to combobox.... (VB.NET)
- Something wrong with this (Visual Basic 4 / 5 / 6)
- How to make javascript form autochange - "Onchange"? (JavaScript / DHTML / AJAX)
Other Threads in the C# Forum
- Previous Thread: SQL Server Netwoking Setup
- Next Thread: C# beginner switch statement
Views: 3926 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for C#
.net 2d access algorithm application array asp.net assembly bitmap box button c# calculator check checkbox class code color combo combobox connectionproblem control conversion csharp custom data database datagrid datagridview dataset degrees directshow display dll drawing event excel exception expression file form format forms ftp function gcd gdi+ graphics image index input install internet label list listbox listener login math mysql object operator pause photoshop php picturebox pixel print programming remote remoting resource resourcefile saving search server socket sql sql-server statistics stream string text textbox thread threading time timer tutorial update validation vc++ view visual webbrowser webcam windows winforms wpf xml





