C#-Get value cell from datagridview

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ratana30
    New Member
    • May 2013
    • 2

    C#-Get value cell from datagridview

    Dear All,

    I am using C# to build up a application. Otherwise, i have two forms, the first form is frmMaterial and the second form is frmMaterialList . frmMaterial has a textbox to get value from datagridview of frmMaterialList .
    My code doesn't work.
    Please help me....
    How to get value from datagridview of frmMaterialList into textbox of frmMaterial?

    Note: frmMaterial has a button to load frmMaterialList



    Thank,
    Ratana
  • Oralloy
    Recognized Expert Contributor
    • Jun 2010
    • 988

    #2
    ratana30,

    Your code doesn't work, but what is it?

    I expect that your frmMaterial should do somthing like
    Code:
    local = frmMaterialList.selectList.Value
    Luck!
    Oralloy

    Comment

    • vijay6
      New Member
      • Mar 2010
      • 158

      #3
      Hey Ratana, try this code.

      To get a value from datagridview

      Code:
      dataGridView1[0, 0].Value

      Note:
      First '0' is Column Index.
      Second '0' is Row Index.

      To get the selected cell value from datagridview

      Code:
      dataGridView1.SelectedCells[0].Value

      Comment

      Working...