Click here to Skip to main content
15,895,084 members
Home / Discussions / C#
   

C#

 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
mprice21419-May-10 18:46
mprice21419-May-10 18:46 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
Henry Minute20-May-10 1:35
Henry Minute20-May-10 1:35 
GeneralRe: ComboBox selection generating list for another comboBox question [modified] Pin
mprice21420-May-10 3:44
mprice21420-May-10 3:44 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
Henry Minute20-May-10 5:23
Henry Minute20-May-10 5:23 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
mprice21426-May-10 19:10
mprice21426-May-10 19:10 
AnswerRe: ComboBox selection generating list for another comboBox question Pin
William Winner18-May-10 7:31
William Winner18-May-10 7:31 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
mprice21418-May-10 7:58
mprice21418-May-10 7:58 
GeneralRe: ComboBox selection generating list for another comboBox question Pin
William Winner18-May-10 11:12
William Winner18-May-10 11:12 
It would have solved some issues if we knew that you were never getting to the SelectedIndexChanged code. I assumed that you had already handle the EditControlShowing event and added the event handler for the SelectedIndexChanged event.

Henry gave you code to do this, but I can try to explain what is happening since you seemed a bit confused about it. When you create the DataGridView, you can specify columns and specify which column within a table or a datasource that that column is linked to. You can also set up what type of control the column is edited with. You can choose a simple TextBox, or you can have other types, for instance the ComboBox type.

When the user clicks within a cell, the DataGridView then checks that column to see what type of control to use to allow the user to edit the cell. This is called the EditControl. If the column type was selected to be a ComboBox, then it will use a ComboBox that the DataGridView created to allow the user to edit the value. It creates the control once and then re-uses it.

The EditControlShowing event is set off when the control is actually shown. This ComboBox is just a standard ComboBox and has all of the same events and properties as a standard ComboBox. One of the arguments passed during this event is e.Control. This is the control that is being used. It won't always be a ComboBox...it will be whatever type of control that is being used for that column. So, when that control is passed, you then need to add a handler to whichever event you are interested in...in this case, the SelectedIndexChanged event. You also want to make sure to remove the handler afterwards so that it doesn't get called more than once. In Henry's case, he removed it before adding a new one which is perfectly reasonable since the user could change the selection more than once without the EditControl changing.

This may be a bit rambly, but I hope it helps with your understanding of what's happening. I wish you luck with this, but I'm still going to say that an internet course without feedback and online tutorials isn't going to get you far. Your company may not be able to afford a programmer, and it may not fit the timetable for this particular project, but I would suggest finding an entry level course on programming at your community college or state university. You can generally do that pretty cheaply and having an instructor that you can ask questions of can help a ton.
GeneralRe: ComboBox selection generating list for another comboBox question Pin
mprice21418-May-10 12:16
mprice21418-May-10 12:16 
QuestionRemoting Service Pin
Britt Mills18-May-10 4:21
Britt Mills18-May-10 4:21 
AnswerRe: Remoting Service Pin
canangirgin18-May-10 4:48
canangirgin18-May-10 4:48 
GeneralRe: Remoting Service Pin
Britt Mills18-May-10 4:56
Britt Mills18-May-10 4:56 
GeneralRe: Remoting Service Pin
canangirgin20-May-10 21:20
canangirgin20-May-10 21:20 
QuestionIE Page size Pin
dSolariuM18-May-10 3:21
dSolariuM18-May-10 3:21 
AnswerRe: IE Page size Pin
Kevin Marois18-May-10 5:10
professionalKevin Marois18-May-10 5:10 
GeneralRe: IE Page size Pin
Luc Pattyn18-May-10 5:58
sitebuilderLuc Pattyn18-May-10 5:58 
GeneralRe: IE Page size Pin
Kevin Marois18-May-10 6:00
professionalKevin Marois18-May-10 6:00 
QuestionOutlook 2007 - Editing calendar information Pin
lvq68418-May-10 3:11
lvq68418-May-10 3:11 
AnswerRe: Outlook 2007 - Editing calendar information Pin
OriginalGriff18-May-10 4:53
mveOriginalGriff18-May-10 4:53 
GeneralRe: Outlook 2007 - Editing calendar information Pin
lvq68418-May-10 7:43
lvq68418-May-10 7:43 
Questionmodifying a html file in windows c# application Pin
Suunil18-May-10 3:00
Suunil18-May-10 3:00 
AnswerRe: modifying a html file in windows c# application Pin
The Man from U.N.C.L.E.18-May-10 3:07
The Man from U.N.C.L.E.18-May-10 3:07 
GeneralRe: modifying a html file in windows c# application Pin
Suunil18-May-10 3:11
Suunil18-May-10 3:11 
GeneralRe: modifying a html file in windows c# application Pin
T M Gray18-May-10 5:10
T M Gray18-May-10 5:10 
AnswerRe: modifying a html file in windows c# application Pin
Not Active18-May-10 3:54
mentorNot Active18-May-10 3:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.