473,320 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Problem with HitTest in DataGrid

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
Nov 21 '05 #1
3 3722
Hi,

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

Ken
---------------------
"Maria Anthonsen" <ma*****@INGENSPAMstart.no> wrote in message
news:OF**************@TK2MSFTNGP09.phx.gbl...
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

Nov 21 '05 #2
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
-------------------------
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:uZ**************@TK2MSFTNGP15.phx.gbl...
Hi,

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

Ken
---------------------
"Maria Anthonsen" <ma*****@INGENSPAMstart.no> wrote in message
news:OF**************@TK2MSFTNGP09.phx.gbl...
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


Nov 21 '05 #3
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
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:uZ**************@TK2MSFTNGP15.phx.gbl...
Hi,

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

Ken
---------------------
"Maria Anthonsen" <ma*****@INGENSPAMstart.no> wrote in message
news:OF**************@TK2MSFTNGP09.phx.gbl...
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

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chris Plowman | last post by:
Hi all, I was wondering if anyone can help me with a really annoying problem I have been having. I made a derived datagrid class that will select the row when a user clicks anywhere on a cell...
0
by: Bernardo | last post by:
I'm making a windows project... I have a datagrid with one checkbox collumn. When I check the checkbox (sometimes) the grid redraws and stays white with a Red X in the middle and the application...
0
by: Bernardo | last post by:
I'm making a windows project... I have a datagrid with one checkbox collumn. When I check the checkbox (sometimes) the grid redraws and stays white with a Red X in the middle and the application...
1
by: Jeff | last post by:
hi there, Does anyone know which event is been called after any column hearders had been clicked? My problem is that the data grid lost selected the row and started an endless loop after I...
3
by: Geraldine Hobley | last post by:
Hello, In my project I am inheriting several forms. However when I inherit from a form and add additional subroutines and methods to my inherited form I get all sorts of problems. e.g. I sometimes...
3
by: dbuchanan | last post by:
Why can't I add the 'Overridable' key word to any of the methods or events in my base class? VB.NET thinks I am trying to define a variable. What am I doing wrong? I get the squiggly line under...
0
by: Ben | last post by:
I have a DataGrid in where I have code in the MouseUp Event that checks the area of the Grid clicked, and highlights the entire row. Problem is, that if you the "Right-Click" on another row, it...
1
by: a4w | last post by:
I am not sure if this is too-granular a question to post to this group; however, I did not see a Tablet-specific group. I am experiencing a problem with the Microsoft.Ink.Ink.HitTest(Point , float)...
2
by: =?Utf-8?B?UGFycm90?= | last post by:
I am trying to implement a drag and drop operation from a listbox to a data gridview control but I keep getting -1 for my row index when the dragdrop function is executed. Below is my coding. ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.