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

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

Are the names and and family names stored in arrays, files, or a database?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.