Hey,
Having somewhat of an issue, I have a datagrid which is giving me issues.
The Datagrid is setup for the user to double click the row, the row is
selected and data within that row populates a form for editing. the problem
is when a user clicks on a cell instead of the whole row, I get an error. My
question is this, is there anyway I can setup the datagrid so when the user
clicks on any cell, the whole row is selected not just that cell. I have set
the datagrid.Readonly=true. Any help would be appreciated.
Thank you,
Terry 4 15411
I converted this on the fly for C# so it hasn't been tested. Put this into
your mouseup or mousedown event on the datagrid. You may also want to test
for hits on HitTestType.RowHeader. Also think about if they use the arrow
keys to move. You may need to dig deeper to get full functionality but
HitTestInfo is the key.
Dim pt as System.Drawing.Point = new System.Drawing.Point (e.X, e.Y)
dim hit as DataGrid.HitTestInfo= DG.HitTest(pt)
if hit.Type == DataGrid.HitTestType.Cell then
DG.CurrentCell = new DataGridCell(hit.Row, hit.Column)
DG.Select(hit.Row)
End If
Hope this helps.
Chris
"Terry" <Te***@discussions.microsoft.com> wrote in message
news:0C**********************************@microsof t.com... Hey, Having somewhat of an issue, I have a datagrid which is giving me issues. The Datagrid is setup for the user to double click the row, the row is selected and data within that row populates a form for editing. the problem is when a user clicks on a cell instead of the whole row, I get an error. My question is this, is there anyway I can setup the datagrid so when the user clicks on any cell, the whole row is selected not just that cell. I have set the datagrid.Readonly=true. Any help would be appreciated. Thank you, Terry
Chris,
Thank you for responding!
I will give this a try
Thanks again,
Terry
"Chris, Master of All Things Insignifican" wrote: I converted this on the fly for C# so it hasn't been tested. Put this into your mouseup or mousedown event on the datagrid. You may also want to test for hits on HitTestType.RowHeader. Also think about if they use the arrow keys to move. You may need to dig deeper to get full functionality but HitTestInfo is the key.
Dim pt as System.Drawing.Point = new System.Drawing.Point (e.X, e.Y) dim hit as DataGrid.HitTestInfo= DG.HitTest(pt) if hit.Type == DataGrid.HitTestType.Cell then DG.CurrentCell = new DataGridCell(hit.Row, hit.Column) DG.Select(hit.Row) End If
Hope this helps. Chris
"Terry" <Te***@discussions.microsoft.com> wrote in message news:0C**********************************@microsof t.com... Hey, Having somewhat of an issue, I have a datagrid which is giving me issues. The Datagrid is setup for the user to double click the row, the row is selected and data within that row populates a form for editing. the problem is when a user clicks on a cell instead of the whole row, I get an error. My question is this, is there anyway I can setup the datagrid so when the user clicks on any cell, the whole row is selected not just that cell. I have set the datagrid.Readonly=true. Any help would be appreciated. Thank you, Terry
Chris,
Transformed this to C# and this worked! As we say here in our IT
Department, "Your The Best!"
Thanks again!
Terry
c# version:
System.Drawing.Point pt = new System.Drawing.Point (e.X,e.Y);
DataGrid.HitTestInfo hit = dgClientRequest.HitTest(pt);
if(hit.Type == DataGrid.HitTestType.Cell)
{
dgClientRequest.CurrentCell = new DataGridCell(hit.Row, hit.Column);
dgClientRequest.Select(hit.Row);
}
"Chris, Master of All Things Insignifican" wrote: I converted this on the fly for C# so it hasn't been tested. Put this into your mouseup or mousedown event on the datagrid. You may also want to test for hits on HitTestType.RowHeader. Also think about if they use the arrow keys to move. You may need to dig deeper to get full functionality but HitTestInfo is the key.
Dim pt as System.Drawing.Point = new System.Drawing.Point (e.X, e.Y) dim hit as DataGrid.HitTestInfo= DG.HitTest(pt) if hit.Type == DataGrid.HitTestType.Cell then DG.CurrentCell = new DataGridCell(hit.Row, hit.Column) DG.Select(hit.Row) End If
Hope this helps. Chris
"Terry" <Te***@discussions.microsoft.com> wrote in message news:0C**********************************@microsof t.com... Hey, Having somewhat of an issue, I have a datagrid which is giving me issues. The Datagrid is setup for the user to double click the row, the row is selected and data within that row populates a form for editing. the problem is when a user clicks on a cell instead of the whole row, I get an error. My question is this, is there anyway I can setup the datagrid so when the user clicks on any cell, the whole row is selected not just that cell. I have set the datagrid.Readonly=true. Any help would be appreciated. Thank you, Terry
LOL, I transformed it out of C# to post it. I'm so use to posting in the VB
group I thought I had to get it into VB for you. At least you got it
working. Do you need to make this work with the Arrow Keys? I was thinking
about it more and might have an easy way to do it.
Chris
"Terry" <Te***@discussions.microsoft.com> wrote in message
news:5E**********************************@microsof t.com... Chris, Transformed this to C# and this worked! As we say here in our IT Department, "Your The Best!" Thanks again! Terry c# version: System.Drawing.Point pt = new System.Drawing.Point (e.X,e.Y); DataGrid.HitTestInfo hit = dgClientRequest.HitTest(pt); if(hit.Type == DataGrid.HitTestType.Cell) { dgClientRequest.CurrentCell = new DataGridCell(hit.Row, hit.Column); dgClientRequest.Select(hit.Row); }
"Chris, Master of All Things Insignifican" wrote:
I converted this on the fly for C# so it hasn't been tested. Put this into your mouseup or mousedown event on the datagrid. You may also want to test for hits on HitTestType.RowHeader. Also think about if they use the arrow keys to move. You may need to dig deeper to get full functionality but HitTestInfo is the key.
Dim pt as System.Drawing.Point = new System.Drawing.Point (e.X, e.Y) dim hit as DataGrid.HitTestInfo= DG.HitTest(pt) if hit.Type == DataGrid.HitTestType.Cell then DG.CurrentCell = new DataGridCell(hit.Row, hit.Column) DG.Select(hit.Row) End If
Hope this helps. Chris
"Terry" <Te***@discussions.microsoft.com> wrote in message news:0C**********************************@microsof t.com... > Hey, > Having somewhat of an issue, I have a datagrid which is giving me > issues. > The Datagrid is setup for the user to double click the row, the row is > selected and data within that row populates a form for editing. the > problem > is when a user clicks on a cell instead of the whole row, I get an > error. > My > question is this, is there anyway I can setup the datagrid so when the > user > clicks on any cell, the whole row is selected not just that cell. I > have > set > the datagrid.Readonly=true. Any help would be appreciated. > Thank you, > Terry > > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
by: selen |
last post by:
Hello
Can I select the cell in datagrid? and can I read its text. I cant do it
asp.net in c#...
Thanks
|
by: Pete Davis |
last post by:
Sorry to have to post this here, but none of the accessibility newsgroups
seem to be active.
I've got a custom control that I'm adding accessibility support to. The
control is a grid control and...
|
by: PawelR |
last post by:
Hello group,
In my application, I have form with DataGrid. Rows in dataGrid are from
table.
myDG.DataSource = myTable;
In Table I have collumn boolean type.
On Click (Mouse_up event) on...
|
by: news |
last post by:
Hello All,
As a VB6/C/C++ (and some Java) developer, I've been toying with c# for
the last couple of weeks. I'm currently trying to create a grid of 3x3
with each cell containing numbers from 1...
|
by: Terry |
last post by:
Hey,
Having somewhat of an issue, I have a datagrid which is giving me issues.
The Datagrid is setup for the user to double click the row, the row is
selected and data within that row populates a...
|
by: Hemant Pathak |
last post by:
Hi...........PM
i m using Vb.6.0 n Datagrid.when i make the focus on ant cell of the datagrid the cell is automaticlly get selected but i want to remove the selection of the text in the cell by...
|
by: =?Utf-8?B?Q2hyaXNK?= |
last post by:
I am using a datagrid as a selection list on a form.
There is an OK button which closes the form and returns the current selection.
I would like to get a doubleclick to perform the same action...
|
by: =?Utf-8?B?UGFycm90?= |
last post by:
I cannot programmatically select a row in datagridview control. I use the
following instruction to change the selection of a row
dataGridView2.ClearSelection();
dataGridView2.Rows.Selected =...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
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...
|
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...
|
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...
|
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)...
|
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...
|
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...
|
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...
| | |