Good Morning Everybody,

I've a problem with a DatagridView in column operation.

this is a Screenshot


My problem that i want to select an idPersonnel for exemple it brings me the name & family name in textboxs

and i didn't found how to do it :(

plz help me :(

Thanks

Attachments DatagridView.jpg 32.2 KB

Try this

Private Sub dataGridView2_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs)
   comboBox = TryCast(e.Control, DataGridViewComboBoxEditingControl)
   comboBox.SelectedValue = comboBox.Text
   comboBox.SelectedIndexChanged -= New EventHandler(comboBox_SelectedIndexChanged)
   comboBox.SelectedIndexChanged += New EventHandler(comboBox_SelectedIndexChanged)
End Sub

and here is event

Private Sub comboBox_SelectedIndexChanged(sender As Object, e As EventArgs)
Messagebox.Show(comboBox.Text)
End Sub

does not work :)

i'm looking about the event that allow me to detect the change inside the Datagridview :(

Try this

Private Sub dataGridView2_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs)
   comboBox = TryCast(e.Control, DataGridViewComboBoxEditingControl)
   comboBox.SelectedValue = comboBox.Text
   comboBox.SelectedIndexChanged -= New EventHandler(comboBox_SelectedIndexChanged)
   comboBox.SelectedIndexChanged += New EventHandler(comboBox_SelectedIndexChanged)
End Sub

and here is event

Private Sub comboBox_SelectedIndexChanged(sender As Object, e As EventArgs)
Messagebox.Show(comboBox.Text)
End Sub

hello nedrosat!
u have to use the the value member of the combobox u r using
for example

datagridview.item("columnname",datagridview.currentrow.index).value = combobox.selectedvalue

may b this will help u

Regards
M.Waqas Aslam

This article has been dead for over six months. Start a new discussion instead.