About Brandon Drake Expertise I can answer questions regarding the Graphics object, file access, general optimization, printing (on paper), user controls, program mathematics, the registry, creating macros, processes, and fundamental or basic questions. I have made a few asp.net pages but I do not know the language extensively. I have not done much work with databases but I have created my own database systems.
Experience I have been programming with visual basic for 6 years. In all I have written programs in about 8 programming languages, although, I only know about 3 well. I have written a few applications but mainly I like to write programs for fun.
Expert: Brandon Drake Date: 8/4/2006 Subject: DataGridView with Combo
Question Hello Sir, Again Hari Here. Just i want to know how to get the left and top of the cell ( I think i will give the coordinate values in Pixels) and convert into the normal coordinates recognized by the combobox.I have tried with ur solution but the above problem is there. Pls send me code if possible.
Thanking you sir,
Regards
Hari Kumar
-------------------------
Followup To
Question -
Hi Sir, I am Hari Kumar.
I am facing one problem in Datagridview of VB.NET 2005.
Can u help me.
Problem 1:
I want to place a combobox control in the datagridview and able to control the navigation. When the Selection_Changed event is fired then only i want to display the combo in the corresponding cell ( not in all the rows of the same column, Only in the selected cell).Can u give me suggession as early as possible.In case if i use the builtin combo supported by DataGridView then I don't want to display the combo in more than one row.
Try to give the suggession with the ToolBox combo (intrinsic).
I should able to set the datasource for that combo ( It is not a problem)
If u can able to send the code I am greateful to u.
I will be waiting for u r valuable reply.
Regards
Hari Kumar
Regards
Hari Kumar
Answer -
Hari Kumar,
I think what you will want to do is create a ComboBox outside of the DataGrid. When the selection changes in the DataGrid you would have to move the ComboBox on top of the field it represents. When the user selected an option in the ComboBox you would have to transfer their option to the DataGrid at the current record.
I have not worked much with DataGrids so this is the best solution I can think of. I think you can get it to work though.
Good Luck,
Brandon Drake
Answer Hari Kumar,
I have never had to do this so I am not sure EXACTLY how to do it but I can give you some suggestions.
First, the "CurrentCell" property of the DataGridView obviously represents the current cell. If you look at it's members there is one called "GetContentBounds" which gets a rectangle that represents the size of the control and possibly it's location.
Some other members that may be useful are the "FirstDisplayedCell" and GetCellDisplayRectangle members of the DataGridView control.
I could not write the code to determine the location of the cell, so you will have to be creative and use the information above to help you.
ONE WARNING--when you get something that works, make sure it works when the user scrolls in the DataGridView.