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. C#
  4. datatype in DataGridview

datatype in DataGridview

Scheduled Pinned Locked Moved C#
c++databasetutorial
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.
  • N Offline
    N Offline
    naylynn
    wrote on last edited by
    #1

    how to divided cell in Datagrid view. My code is don't work in fraction number. Someone advise me. Thanks you all.

    foreach (DataGridViewRow row in this.dataGridView1.Rows)
    {
    int R1 = row.Index;
    for (b = 0; b < dataGridView2.ColumnCount; b++)
    {
    a = 0;
    for (c = 0; c < dataGridView2.RowCount; c++)
    {
    Ans_Grid.Rows[R1].Cells[b].Value =
    (((Double.Parse(dataGridView1.Rows[R1].Cells[c].Value.ToString()))
    * (Double.Parse(dataGridView2.Rows[c].Cells[b].Value.ToString())))).ToString()
    ;
    Ans_Grid.Rows[R1].Cells[b].Value = a + Convert.ToInt16(Ans_Grid.Rows[R1].Cells[b].Value);
    a = Convert.ToDouble(Ans_Grid.Rows[R1].Cells[b].Value);

    R 1 Reply Last reply
    0
    • N naylynn

      how to divided cell in Datagrid view. My code is don't work in fraction number. Someone advise me. Thanks you all.

      foreach (DataGridViewRow row in this.dataGridView1.Rows)
      {
      int R1 = row.Index;
      for (b = 0; b < dataGridView2.ColumnCount; b++)
      {
      a = 0;
      for (c = 0; c < dataGridView2.RowCount; c++)
      {
      Ans_Grid.Rows[R1].Cells[b].Value =
      (((Double.Parse(dataGridView1.Rows[R1].Cells[c].Value.ToString()))
      * (Double.Parse(dataGridView2.Rows[c].Cells[b].Value.ToString())))).ToString()
      ;
      Ans_Grid.Rows[R1].Cells[b].Value = a + Convert.ToInt16(Ans_Grid.Rows[R1].Cells[b].Value);
      a = Convert.ToDouble(Ans_Grid.Rows[R1].Cells[b].Value);

      R Offline
      R Offline
      Raj Mouli
      wrote on last edited by
      #2

      may be decimal will help you in getting your issue fixed

      Mouli

      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