473,385 Members | 1,523 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,385 software developers and data experts.

Selecting a cell from a datagrid

12
Hey everyone,
I have a datagrid that I would like to get the value of a cell that a user clicks on. Say a user clicks on the first row can I get the value of the cell in the first column, or any column for that matter.
Thanks
Mar 20 '07 #1
7 1121
For one thing you will need details view and a few SQL queries to make it work
i am searching for my code i have for one if i find it i will post it for you so you can see
Mar 20 '07 #2
twigboy
12
Thanks for looking.
I currently do have the details view for the cell value I want from the datagrid and I will be using sql queries to get the data.
Mar 20 '07 #3
i will have to look when i get home cause i m at wokr right now and my program is at home i will pm you with the code after i find it
Mar 20 '07 #4
i will have to look when i get home cause i m at wokr right now and my program is at home i will pm you with the code after i find it
HI

On DataGridView1_CellDoubleClick event paste this code it will definately work

dim stdata
stdata = datagridmainform.CurrentRow.Cells.Item(0).Value.To String()

In this on datagrid view the first column i.e item(0) value comes in stdata


Cheers
Mahesh
Mar 21 '07 #5
twigboy
12
sweet thanks mahesh. I am actually using c# but I think they should have the same properties.


HI

On DataGridView1_CellDoubleClick event paste this code it will definately work

dim stdata
stdata = datagridmainform.CurrentRow.Cells.Item(0).Value.To String()

In this on datagrid view the first column i.e item(0) value comes in stdata


Cheers
Mahesh
Mar 21 '07 #6
twigboy
12
Alright I just tried it with C# but it does not have an Item() property.
Any ideas?
Mar 21 '07 #7
twigboy
12
WooooWhooo.
I got it with datagridview.currentrow.cells[0].value
Thanks for the help
Mar 21 '07 #8

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

Similar topics

5
by: Axial | last post by:
Question: How to select columns from Excel-generated XML when some cells are empty. I've found examples where rows are to be selected, but I can't seem to extrapolate from that to selecting...
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...
3
by: Dhanraj K | last post by:
Hello All, I am new to CSharp. Somebody please tell me how to select the entire row in a data grid on a mouse click event on any of the cell. Thanx in advance Dhannu
1
by: orekinbck | last post by:
Hi There I have a datagrid whose main purpose in life is to provide a nice way for users to make a single choice from a list. The grid is read only, single row select and has its data source as...
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: Daniel Walzenbach | last post by:
Hi, I created an ASP.NET Datagrid where a single row can be selected by clicking anywhere on the row (according to...
10
by: JohnR | last post by:
I have a datatable as the datasource to a datagrid. The datagrid has a datagridtablestyle defined. I use the datagridtablestyle to change the order of the columns (so they can be different than...
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...
1
by: Tarik Monem | last post by:
Hi Everyone, I've been trying to do this application that I've been working on from so many different angels and I seem to be running into some kind of wall with every attempt. I have scrapped...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.