473,406 Members | 2,710 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,406 software developers and data experts.

VB.Net progam the selecting of a row of a DataGridView

Hi all,

I can detect the active row (iRowIndex: see below please) and do whatever I
want, but I do not seem to be able to set a row to be selected.

How can I do that in vb.Net?

Private Sub DataGridView1_MouseDown(etc.....

Dim btnLeft = Windows.Forms.MouseButtons.Left

If e.Button = btnLeft Then

Dim hit As DataGridView.HitTestInfo = DataGridView1.HitTest(e.X, e.Y)
If hit.Type = DataGridViewHitTestType.Cell Then
clickedCell = DataGridView1.Rows(hit.RowIndex).Cells(hit.ColumnI ndex)
iRowIndex = CInt(hit.RowIndex)
etc...
Jul 21 '08 #1
1 1106
On 21 Jul 2008 17:57:43 GMT, "News.Individual.NET"
<jo********@hotmail.co.ukwrote:
>Hi all,

I can detect the active row (iRowIndex: see below please) and do whatever I
want, but I do not seem to be able to set a row to be selected.

How can I do that in vb.Net?

Private Sub DataGridView1_MouseDown(etc.....

Dim btnLeft = Windows.Forms.MouseButtons.Left

If e.Button = btnLeft Then

Dim hit As DataGridView.HitTestInfo = DataGridView1.HitTest(e.X, e.Y)
If hit.Type = DataGridViewHitTestType.Cell Then
clickedCell = DataGridView1.Rows(hit.RowIndex).Cells(hit.ColumnI ndex)
iRowIndex = CInt(hit.RowIndex)
etc...
Set the Row.Selected property to True.
Jul 21 '08 #2

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

Similar topics

3
by: David | last post by:
I'm creating a C# (.NET BETA2) Windows application (NOT a Web application, a Windows application), and I would like to programmatically selecting a row inside of a DataGridView. It seems like it...
0
by: Manuel | last post by:
Is there a way to select the rows with a filter in a DataGridView? Example: having a grid displaying EmployeeID, Name, Address, City, Zip Something like MyGrid.SelectMatchingRows("City='Miami'")...
2
by: Bob | last post by:
How do I show a calendar control or another appropriate control to pick a date and time for a cell in a column in a datagridview? Thanks for any help. Bob
1
by: romerve | last post by:
Hello, I am interested on how to edit/view an item or record selected from a DataGridView. The SQL queries for some data including the ID which is not visible on the GridView. I want to be...
2
by: Dom | last post by:
I posted this before, no takers. Trying again. Is there anyway to cancel the selection of a new cell in a DataGridView? For example, if the user selects a cell with the control key down, then...
2
by: ravitunk | last post by:
hi..i have a datagridview in my windows application using C#......i want to select mutiple cells(by pressing shift key) or select mutiple columns or multiple rows.....if this happens then i should...
0
by: Greg Smith | last post by:
I am dumping a third party Grid product and going to Microsoft's DataGridView in my vs2008 C# Windows projects. In converting my code I can't seem to find a way to select a specific record (i.e....
0
by: richkid | last post by:
hello, I have a datagridview on my form that is populated with thousands of records from a database. When I add a new product, I want the new product to be the one selected. I've tried aot...
4
by: techno58 | last post by:
In my form i want to be able to fill all my controls with a particular record by selecting that record from my datagridview.If i select a particular record after clicking on it all my controls like...
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
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?
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.