Accessing a TextBoxColumn in a DataGrid in a Form?

  • Thread starter Thread starter Lars Netzel
  • Start date Start date
L

Lars Netzel

How do I access a specific textbox in a TextBoxColumn in a Datagrid that is
bound to a dataset?

/lars
 
Hi Lars,

You can try this

In the DataGridComboBox column class you can add
Public Event ComboSelectedIndexChanged()

Than you can make an event in that class for the SelectedIndexChanged which
has the row
RaiseEvent ComboSelecteIndexChanged()

Than in the form you have to make the combobox global (private) withevents,
than you can catch it. I did try it however did not look for side effects, I
saw it fires more than you probably want so that you should prevent too.

I hope this helps?

Cor
 
I'm not really sure of what you mean I should do...

I added this code to the Class
-----------------------------------------------

Public Event ComboSelectedIndexChanged()


Public Sub ColumnComboBox_SelectedIndexChanged(ByVal sender As Object, ByVal
e As EventArgs) Handles ColumnComboBox.SelectedIndexChanged

RaiseEvent ComboSelectedIndexChanged()

End Sub

--------------------------------------------

Then in the form I added
--------------------------------------------
WithEvents ComboBoxColumn As DataGridComboBoxColumn

Private Sub ComboBoxColumn_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles
ComboBoxColumn.ComboSelectedIndexChanged

MsgBox("CAUGHT EVENT")

End Sub

-----------------------------------------------------

I can't complile at all I get an error on my Sub in the Form saying

" Method 'ComboBoxColumn_SelectedIndexChanged' cannot handle Event
'ComboSelectedIndexChanged' because they do not have the same signature."


/Lars
 
Hi Lars,

Was the answer on the other question.

In a datagrid you should try never to access the datagrid itself however
always the underlaying table. And if possible using the dataview that you
have created because otherwise you can have problems when the user sorts the
datagrid.

I hope this helps.

Cor
 
Back
Top