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

Getting the value of a selected DataGridView row/column

Hi,

I'm trying to grab a string of the value in the first column of a
DataGridView object on the selected row. What's the easiest way to go
about that?

I'm building part of a SQL statement inside a loop:

strSQL &= Str(myGrid.SelectedRow(ColumnIndex)) & "," &
Str(dgvResults.Item(1, i)) & "," & Str(Now) & ")"

Obviously, there's no "myGrid.SelectedRow(ColumnIndex)" function.
There's SelectedRows(Index), but that's for something else. What
should I use?

Thanks,

Andy

Jul 24 '07 #1
2 21216
Hi,
try this code:
DataGridView1.Rows(DataGridView1.CurrentCell.RowIn dex).Cells().Value
--
Hope this helps.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.

"at*****@wi.rr.com" wrote:
Hi,

I'm trying to grab a string of the value in the first column of a
DataGridView object on the selected row. What's the easiest way to go
about that?

I'm building part of a SQL statement inside a loop:

strSQL &= Str(myGrid.SelectedRow(ColumnIndex)) & "," &
Str(dgvResults.Item(1, i)) & "," & Str(Now) & ")"

Obviously, there's no "myGrid.SelectedRow(ColumnIndex)" function.
There's SelectedRows(Index), but that's for something else. What
should I use?

Thanks,

Andy

Jul 24 '07 #2
On Jul 24, 1:32 am, Manish Bafna
<ManishBa...@discussions.microsoft.comwrote:
Hi,
try this code:
DataGridView1.Rows(DataGridView1.CurrentCell.RowIn dex).Cells().Value
--
Hope this helps.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.

"atle...@wi.rr.com" wrote:
Hi,
I'm trying to grab a string of the value in the first column of a
DataGridView object on the selected row. What's the easiest way to go
about that?
I'm building part of a SQL statement inside a loop:
strSQL &= Str(myGrid.SelectedRow(ColumnIndex)) & "," &
Str(dgvResults.Item(1, i)) & "," & Str(Now) & ")"
Obviously, there's no "myGrid.SelectedRow(ColumnIndex)" function.
There's SelectedRows(Index), but that's for something else. What
should I use?
Thanks,
Andy- Hide quoted text -

- Show quoted text -
That was it! Thank you very much.

Andy Lewis

Jul 25 '07 #3

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

Similar topics

4
by: Aaron Smith | last post by:
Ok, this is an odd one, but I could use some assistance with the framework 2 in VB.Net... I want to have a DataGridViewColumn, only have it use the ComboBox, then when they drop down the...
5
by: bob | last post by:
Now this ought to be a simple matter. But nothing's simple in the Net world, I'm finding. In vb6 you could use "!" to force text to upper case in the format function. I've searched the vb.net...
1
by: martin1 | last post by:
Hi, All, DataGridView is populated with all coumns from database since i need some columns data for condition statement, after that I want to show rest of column in the DataGridView, so how to...
4
by: svaradan | last post by:
Hi I have a situation where in I have two combo boxes in a datagridview control. The first combo box items are all static. But the second combo box items need to change based on the first...
1
by: bbasberg | last post by:
Hi, I am wondering how to get a value from one column based on another, using visual basic for applications. Here are the criteria: The first column contains status and we want the next row in...
1
by: Chalkie | last post by:
Hello, I've hit what appears to be a serious problem with an unbound datagridview control that Ive added to a VB.Net program. Inadvertently I named one column 'Name' and a second 'Size'. The...
0
by: sk27ahmed | last post by:
Hi Any one can show me how to access datagridview column value on column checked unchecked. I create one column in datagridview of type checkbox,and on button click i write code to select all...
2
by: Steve | last post by:
Hi All I am using VB.net 2005 windows forms I use the Datagridview.cellformatting event to change the colours of individual cells as required and all works fine How can I do the same for...
1
by: JB | last post by:
Hi All, I'd like to display password characters in a DataGridView column, the same way I can do in a standard TextBox by using the PasswordChar property (i.e.typed characters replaced by a star...
0
by: lenniekuah | last post by:
Hi Fellow Good Guys, I need your help, Please Help me. Surprising I encounterd another problem which never happened in VB.NET but in C# technique it causing problem. Here is the explanation...
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: 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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.