need help getting the value from a selected row in DataGridView
-
<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 Friend WithEvents CustomerID As System.Windows.Forms.DataGridViewTextBoxColumn '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.Label1 = New System.Windows.Forms.Label Me.DataGridView1 = New System.Windows.Forms.DataGridView Me.CustomerID = New System.Windows.Forms.DataGridViewTextBoxColumn CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'Label1 ' Me.Label1.AutoSize = True Me.Label1.Location = New System.Drawing.Point(13, 181) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(39, 13) Me.Label1.TabIndex = 0 Me.Label1.Text = "Label1" ' 'DataGridView1 ' Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.DataGridView1.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn(){Me.CustomerID}) Me.DataGridView1.Location = New System.Drawing.Point(16, 12) **Me.DataGridView1.MultiSelect = False** Me.DataGridView1.Name = "DataGridView1" **Me.DataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect** Me.DataGridView1.Size = New System.Drawing.Size(240, 150) Me.DataGridView1.TabIndex = 1 ' 'CustomerID ' Me.CustomerID.HeaderText = "CustomerID" Me.CustomerID.Name = "CustomerID" ' '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, 264) Me.Controls.Add(Me.DataGridView1) Me.Controls.Add(Me.Label1) Me.Name = "Form1" Me.Text = "Form1" CType(Me.DataGridView1, System.ComponentModel.ISuppor
-
<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 Friend WithEvents CustomerID As System.Windows.Forms.DataGridViewTextBoxColumn '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.Label1 = New System.Windows.Forms.Label Me.DataGridView1 = New System.Windows.Forms.DataGridView Me.CustomerID = New System.Windows.Forms.DataGridViewTextBoxColumn CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'Label1 ' Me.Label1.AutoSize = True Me.Label1.Location = New System.Drawing.Point(13, 181) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(39, 13) Me.Label1.TabIndex = 0 Me.Label1.Text = "Label1" ' 'DataGridView1 ' Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.DataGridView1.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn(){Me.CustomerID}) Me.DataGridView1.Location = New System.Drawing.Point(16, 12) **Me.DataGridView1.MultiSelect = False** Me.DataGridView1.Name = "DataGridView1" **Me.DataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect** Me.DataGridView1.Size = New System.Drawing.Size(240, 150) Me.DataGridView1.TabIndex = 1 ' 'CustomerID ' Me.CustomerID.HeaderText = "CustomerID" Me.CustomerID.Name = "CustomerID" ' '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, 264) Me.Controls.Add(Me.DataGridView1) Me.Controls.Add(Me.Label1) Me.Name = "Form1" Me.Text = "Form1" CType(Me.DataGridView1, System.ComponentModel.ISuppor
Hi Shimi I am using the following code which works for me DataGrid_search.CurrentRow.Cells.Item(0).Value.ToString() Good Luck