|
-
Jul 13th, 2011, 10:41 PM
#1
Thread Starter
Member
DataGridView Entire Row Selection
Hi, I want to know if it is possible to click in one cell, and the entire row be selected.
Thanks =D
-
Jul 13th, 2011, 10:59 PM
#2
Re: DataGridView Entire Row Selection
The first thing you should do with a control is open the Properties window and see what properties it has. Your answer is in there.
-
Jul 13th, 2011, 11:15 PM
#3
Thread Starter
Member
Re: DataGridView Entire Row Selection
 Originally Posted by jmcilhinney
The first thing you should do with a control is open the Properties window and see what properties it has. Your answer is in there.
I tried but nothing happened, but thanks anyway =D
I were searching in the forum and I found this which solved my problem =D
Thanks.
-
Jul 13th, 2011, 11:30 PM
#4
Re: DataGridView Entire Row Selection
 Originally Posted by ikartz
I tried but nothing happened
Tried what? The SelectionMode property appears in the properties window and you should be setting it there, as was my implication, rather than in code.
-
Jul 14th, 2011, 07:38 AM
#5
Thread Starter
Member
Re: DataGridView Entire Row Selection
 Originally Posted by jmcilhinney
Tried what? The SelectionMode property appears in the properties window and you should be setting it there, as was my implication, rather than in code.
believe me, I changed it to 'FullRowSelection' but I could only select cell at cell
that's why I asked for help here =)
-
Jul 14th, 2011, 07:51 AM
#6
Re: DataGridView Entire Row Selection
 Originally Posted by ikartz
believe me, I changed it to 'FullRowSelection' but I could only select cell at cell
that's why I asked for help here =)
That's probably something that you should have included in your first post, e.g.
I have already set the SelectionMode property to FullRowSelect in the Properties window but it doesn't seem to work.
That said, if you really did set SelectionMode to FullRowSelect and it didn;t work then something is broken in your project or on your system. That is the one and only way to achieve your aim and whether you write code or do it in the designer should make no difference, because doing it in the designer simply generates code anyway. I just tested it out myself to make sure, even though I already knew that was the case. Here's the designer code for a form with nothing but a DGV added and that property set:
Code:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.DataGridView1 = New System.Windows.Forms.DataGridView()
CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'DataGridView1
'
Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.DataGridView1.Dock = System.Windows.Forms.DockStyle.Fill
Me.DataGridView1.Location = New System.Drawing.Point(0, 0)
Me.DataGridView1.Name = "DataGridView1"
Me.DataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect
Me.DataGridView1.Size = New System.Drawing.Size(284, 262)
Me.DataGridView1.TabIndex = 0
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(284, 262)
Me.Controls.Add(Me.DataGridView1)
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents DataGridView1 As System.Windows.Forms.DataGridView
End Class
-
Jul 14th, 2011, 12:21 PM
#7
Thread Starter
Member
Re: DataGridView Entire Row Selection
ok =)
thanks and sorry about that =)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|