|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ADO.NET 2.0 - Get the value current record using the DataGridViewHello,
I have a Contacts DataGridView that is bound to the TblContactsBindingSource. The Grid contains a list of contacts including the contacts name (Column 2 or "ContactName") I would like to get the value of the current "ContactName". What is the easiest way to do this? Thanks in Advance Phil Phil,
In this kind of questions is forever important in which event. In fact is everywhere the currencymanager the most easiest class to handle your question, however that needs that you know more from binding than mostly is known by people using the designer. Cor Hi,
"Phil Williams" <Phillandsa***@hotmail.com> wrote in message Dim contactName As String = news:eltqOq5KGHA.1568@TK2MSFTNGP10.phx.gbl... > Hello, > I have a Contacts DataGridView that is bound to the > TblContactsBindingSource. > > The Grid contains a list of contacts including the contacts name (Column 2 > or "ContactName") > I would like to get the value of the current "ContactName". > > What is the easiest way to do this? CStr(DirectCast(TblContactsBindingSource.Current, DataRowView)("ContactName")) or Dim contactName As String = CStr(DataGridView.CurrentRow.Cells(1).Value) HTH, Greetings Show quote > > > Thanks in Advance > Phil > Thanks, it is soo easy when you know how!
Thanks again, Phil Show quote "Bart Mermuys" <bmermuys.nospam@hotmail.com> wrote in message news:e0f1o09KGHA.3164@TK2MSFTNGP11.phx.gbl... > Hi, > > "Phil Williams" <Phillandsa***@hotmail.com> wrote in message > news:eltqOq5KGHA.1568@TK2MSFTNGP10.phx.gbl... >> Hello, >> I have a Contacts DataGridView that is bound to the >> TblContactsBindingSource. >> >> The Grid contains a list of contacts including the contacts name (Column >> 2 or "ContactName") >> I would like to get the value of the current "ContactName". >> >> What is the easiest way to do this? > > Dim contactName As String = > CStr(DirectCast(TblContactsBindingSource.Current, > DataRowView)("ContactName")) > > or > > Dim contactName As String = CStr(DataGridView.CurrentRow.Cells(1).Value) > > > HTH, > Greetings > >> >> >> Thanks in Advance >> Phil >> > > |
|||||||||||||||||||||||