Problem with HitTest in DataGrid

  • Thread starter Thread starter Maria Anthonsen
  • Start date Start date
M

Maria Anthonsen

I'm using HitTest to get a value from the cells into a textbox. I have put
the HitTest code into the MouseDown-event, and everything is working except
one thing. When I start the program the value in the first column/row is
highlighted and the HitTest doesn't retrieve a value if I click on that
cell. Is there a way to get a datagrid to not highlight a cell - or are
there any other ways to solve this?

HitTest-code (simplified)
Dim xInfo As DataGrid.HitTestInfo

xInfo = Me.dgNames.HitTest(e.X, e.Y)

MessageBox.Show(dgNames.Item(xInfo.Row, xInfo.Column))


Thanks!

Maria
 
Hi,

You will have to read the xml in manually. Hopefully this will
get you started.
http://support.microsoft.com/default.aspx?scid=kb;en-us;301225

Ken
---------------------
I'm using HitTest to get a value from the cells into a textbox. I have put
the HitTest code into the MouseDown-event, and everything is working except
one thing. When I start the program the value in the first column/row is
highlighted and the HitTest doesn't retrieve a value if I click on that
cell. Is there a way to get a datagrid to not highlight a cell - or are
there any other ways to solve this?

HitTest-code (simplified)
Dim xInfo As DataGrid.HitTestInfo

xInfo = Me.dgNames.HitTest(e.X, e.Y)

MessageBox.Show(dgNames.Item(xInfo.Row, xInfo.Column))


Thanks!

Maria
 
Hi,

Sorry wrong question. There is a tip in the syncfusion web site
that tells you how to make a grid have no active cell

http://www.syncfusion.com/FAQ/WinForms/default.asp#44

Ken
-------------------------
Hi,

You will have to read the xml in manually. Hopefully this will
get you started.
http://support.microsoft.com/default.aspx?scid=kb;en-us;301225

Ken
---------------------
I'm using HitTest to get a value from the cells into a textbox. I have put
the HitTest code into the MouseDown-event, and everything is working except
one thing. When I start the program the value in the first column/row is
highlighted and the HitTest doesn't retrieve a value if I click on that
cell. Is there a way to get a datagrid to not highlight a cell - or are
there any other ways to solve this?

HitTest-code (simplified)
Dim xInfo As DataGrid.HitTestInfo

xInfo = Me.dgNames.HitTest(e.X, e.Y)

MessageBox.Show(dgNames.Item(xInfo.Row, xInfo.Column))


Thanks!

Maria
 
Sorry - I should have given a better explanation...

I have filled a DataSet with data from a SQLServer database. I have set the
DataSource of the DataGrid to this dataset. When I click in one of the
cells in the datagrid - I would like to get the value to a textbox.

I have used the HitTest-function in the datagrid to get the value in the
cell - but the value in the first cell is highlighted, and the HitTest
doesn't work on this cell. It works on all other cell except this first
highlighted one.

Does you suggestion mean that the first cell will not be highlighted? If I
read the xml manually - how do I know witch cell was clicked?

Maria
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top