Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. need help getting the value from a selected row in DataGridView

need help getting the value from a selected row in DataGridView

Scheduled Pinned Locked Moved Visual Basic
graphicshelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Shimmy Weitzhandler
    wrote on last edited by
    #1

    <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

    N 1 Reply Last reply
    0
    • S Shimmy Weitzhandler

      <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

      N Offline
      N Offline
      nishkarsh_k
      wrote on last edited by
      #2

      Hi Shimi I am using the following code which works for me DataGrid_search.CurrentRow.Cells.Item(0).Value.ToString() Good Luck

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups