vb.net / DataGridView / ComboBox Column? - vb.net

I have a Data Grid View and some of the columns are of type ComboBox. What happends is that when I click on a cell that's a ComboBox it Selects the ComboBox but I have to click it again for it dropdown and show the Combox Items. How can I have it do this with one click?

Set your DataGridView's EditMode property to DataGridViewEditMode.EditOnEnter.

Related

autocomplete select event in datagridview vb.net

I have an autocomplete on datagridview from an sql datbase.
I want that if an item selected from the autocomplete list in one cell the other cells will complete automatilcly from the database. I can't find an autocomplete event that indicates an item was selected.

How to load items from combox into datagridview

How can I get items from combobox in to datagridview and when i click on a cell in datagridview it will lead me to edit so i'm thinking for edit when user clicks on a cell i will display its raw item in texbox and when user press enter it will change in in datagridview as well as in combox
how should i do this in vb.net
You will need to be more clear with your question.
But, for example if you have some items in your ComboBox you can copy them to DGV like this:
For Each item In ComboBox.Items 'loops over combobox
DataGridView.Rows.Add(item) 'adds a new row to datagridview and puts a value from combobox in it
Next

DataGridView ComboBox Cell error when closing form

I have a ComboBox column on my datagridview, the ComboBox is bound to a datasource for the values.
On Form Load I add rows and data to my DataGridView from a database table, here's how I add the value to the combobox column. This code is inside a loop, hence the rowindex variable.
Dim combo As DataGridViewComboBoxCell
combo = CType(Me.DataGridView1(3, rowindex), DataGridViewComboBoxCell)
combo.Value = sqldr("company_code")
It works fine for me, the combobox value is changed to what I had in my table and I can change the value of the cell using the combobox but if I try closing the form I get this error which just keeps repeating if I press Ok, I have to stop debugging just to exit the application.

about datagridview

I have a form that I want to add the content of the datagridview to a listbox every time I double clik on the cell of the datagridview, then store the contents of the listbox in my database. please help.
Use the cellclick event off the datagridview, http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.cellclick.aspx
Then implement a "system"(session or something) that keeps track of the clicks when the amount of clicks = 2, add the cell value to your listbox and reset the counter to 0.
When do you want the storing of the contents in the listbox to occure?

How to make custom Combo box control which have contain datagrid in vb.net

I want to make custom combo box which have contain datagrid and textbox too.
On clicks into combo box datagridview should be appear and selecting any row particular cell value of the datagridview added on the combo.
thanks in advance..
As your question is written I have no idea how to answer it, I can't figure out how you could sensibly show a DataGridView inside a ComboBox. I'm writing this answer with the assumption that you mean that the form should have a ComboBox that are "linked" to a DataGridView rather than actually contain it.
If so, all you need to do is to add the ComboBox and DataGridView to the form, make the DataGridView invisible. Then you handle the SelectedIndexChanged event for the ComboBox, in the handler, make the grid visibile, find the index of the row and column you want to show and write code like (code not tested so might not be correct):
grid.SelectedRows.Clear()
grid.FirstDisplayedScrollingRowIndex = rowIndex
grid.Rows(rowIndex).Cells(colIndex).Selected = True
grid.Show()