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

Selecting rows in a datagrid

137 100+
Hello,
I have an datagrid but when i select a loaded value he has to show a certain messagebox.
But, if i select the most left column he has to do something else.
Sofar i came to this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged
  2.  
  3.  
  4.         If DataGrid1.CurrentCell.ColumnNumber >= 0 Then
  5.  
  6.             MsgBox("Click on the button before the row to order and cut woodsheets")
  7.  
  8.         ElseIf DataGrid1.CurrentCell.ColumnNumber = -1 Then
  9.  
  10.             MsgBox("test")
  11.  
  12.         End If
  13.  
  14.     End Sub
  15.  
  16.  
with this code he does all the same, inclusive the most left (blank) column.

Thanks in advance
Aug 2 '08 #1
1 822
djpaul
137 100+
Ah, found a solution
This worked for me, not the best but it works!

Expand|Select|Wrap|Line Numbers
  1.  Dim grid As DataGrid.HitTestInfo
  2.  
  3.         grid = DataGrid1.HitTest(e.X, e.Y)
  4.  
  5.         If grid.Type.ToString = "RowHeader" Then
  6.  
  7.                'Do things
  8.  
  9.        ElseIf DataGrid1.Item(grid.Row, 3) = 0 Then
  10.  
  11.                'Do other things
  12.  
  13.        End if
  14.  
Aug 3 '08 #2

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

Similar topics

1
by: Deep Silent Ocean | last post by:
Hi All I have one specific question for DataGrid In the Form Load event of the Form, I am binding data with DataGrid. On clicking Row the CurrentRowIndex is updated and it gives me correct...
6
by: aaa | last post by:
Hi I am trying to create a read-only DataGrid that would always have current row selected. Currently, I am using method: public void SelectDataGridRow(DataGrid dg) { if (dg.CurrentRowIndex >...
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...
6
by: aaj | last post by:
Hi all I use a data adapter to read numerous tables in to a dataset. The dataset holds tables which in turn holds full details of the records i.e. keys, extra colums etc.. In some cases I...
1
by: Jay | last post by:
Hi All, My users are complaining about the page refreshing when they are selecting multiple rows in a datagrid. Has anyone tried to manage this using javascript? I tried smartnavigation but that...
1
by: Dan | last post by:
I'd like to let a user select multiple rows from a Web Form datagrid, and then perform actions on the selected rows when I get a postback. How would I do that? Dan
1
by: sneha123 | last post by:
There will be some 20 questions and for each question there will be 4 choices.what i want to do is to select multiple answers by clicking the checkbox. i m using asp.net,vb.net pls help me we...
1
by: Bob Loveshade | last post by:
I am looking for an example that shows how to select and highlight multiple rows in a DataGrid. My DataGrid is part of a Web User Control which is contained in an ASPX page. I haven't been...
2
by: ewingate | last post by:
I have a form with two text boxes, a button, and a datagrid control which is bound to my SQL DB. There are two columns on the datagrid, one for each of the textboxes on the form. I have already...
0
by: rhepsi | last post by:
hii.. i have arequirement where... i want to update a field to N for the rows that are present in the datagrid... 1) strSQL = "UPDATE tbl_worker_profile SET " & _ ...
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
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: 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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.