473,320 Members | 1,881 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.

Select the content of a cell of the datagrid view

I want to select the content of a cell of the data grid view, actually i got the code as follows

Expand|Select|Wrap|Line Numbers
  1. Dim a, b As Integer
  2.         a = e.RowIndex
  3.         b = e.ColumnIndex
  4.  
  5.        MsgBox(a & b)
  6.         MsgBox( showsearch.SelectedRows(0).Cells(0).Value)
  7.  
but it works only when i click on the text of that cell and not on the area at the side of the text.
Mar 10 '10 #1

✓ answered by Frinavale

You should check out what DataGrid Events are available to you and handle the one that you think is the most appropriate for your situation.

In your case I think you would be most interested in handling the CellClick Event.

-Frinny

2 1319
Frinavale
9,735 Expert Mod 8TB
You should check out what DataGrid Events are available to you and handle the one that you think is the most appropriate for your situation.

In your case I think you would be most interested in handling the CellClick Event.

-Frinny
Mar 10 '10 #2
yes it really works by changing the events to datagridview_cellclick event


thankz.........
Mar 11 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
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...
9
by: Prowler | last post by:
In our current application we have a page whose sole purpose for existence is to permit the user to select from a list (subsequent to our login page). We would like to have the list drop down...
4
by: Bruce Pullum | last post by:
I have a datagrid that I am using a DataView with. All works great for the sorting of the columns. However, after I sort the column, and then try and select a data row to edit, the row selected...
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...
5
by: Randy | last post by:
Hello, Can someone tell me how you de-select (un select) the currently selected cell in a datagrid? Thanks
4
by: Steve B. | last post by:
I have a DataGrid on the left and TextBoxes (TB) on the right. The TB's reflect the contents of the grid cells. Sorting of columns (both thru VS and programmatically) work fine except, when the...
0
by: elime | last post by:
Hi all I have a strange behaving on some PC with my DataGrid. It only occurs on some PC, on others it works perfectly fine. ->(same ..net version installed) it's very confusing. starting...
2
by: Maziar Aflatoun | last post by:
Hi, I have a datagrid which binds to a datareader dgXXXXX.DataSource = rdr; dgXXXXX.DataBind(); On dgXXXXX_EditCommand I can read the value of the selected row( e.Item.ItemIndex) which...
3
by: AA | last post by:
Do anyone know how to select a full row in datagrid instead of a particular cell? Whenever user click on a cell, I want to whole row to be selected. I tried to code that in the...
3
by: Ryan Liu | last post by:
Can someone give a sample to prevent a row from being deleted in a datatable? I tried e.Row.RejectChanges(); in dt_RowDeleting() but seems does not work. I need verify if there other data...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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...
1
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: 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)...
0
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.