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. Managed C++/CLI
  4. c++ forms 2022 code

c++ forms 2022 code

Scheduled Pinned Locked Moved Managed C++/CLI
questioncsharpc++winforms
2 Posts 2 Posters 5 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.
  • U Offline
    U Offline
    User 8809446
    wrote on last edited by
    #1

    What is the wrong with this code? I simply want to show data from a datatable I have just made in a datagidview. The code runs well but doesn't show the data. NB: the code written in c++ winforms 2022 The code:

    DataTable ^dt = gcnew DataTable();

    				 dt->Columns->Add("Name");
    				 dt->Columns->Add("Surname");
    				 dt->Columns->Add("Address");
    				 dt->Columns->Add("Phone");
    
    				 DataRow^ datarow = dt->NewRow();
    				 					 
    				 datarow\["Name"\] = 
    

    "Ahmad";
    datarow["Surname"] = "Hassan";
    datarow["Address"] = "Cairo";
    datarow["Phone"] = "0987654321";

    				 dt->Rows->Add(datarow);
    
    				 dataGridView1->DataSource = dt;
    
    L 1 Reply Last reply
    0
    • U User 8809446

      What is the wrong with this code? I simply want to show data from a datatable I have just made in a datagidview. The code runs well but doesn't show the data. NB: the code written in c++ winforms 2022 The code:

      DataTable ^dt = gcnew DataTable();

      				 dt->Columns->Add("Name");
      				 dt->Columns->Add("Surname");
      				 dt->Columns->Add("Address");
      				 dt->Columns->Add("Phone");
      
      				 DataRow^ datarow = dt->NewRow();
      				 					 
      				 datarow\["Name"\] = 
      

      "Ahmad";
      datarow["Surname"] = "Hassan";
      datarow["Address"] = "Cairo";
      datarow["Phone"] = "0987654321";

      				 dt->Rows->Add(datarow);
      
      				 dataGridView1->DataSource = dt;
      
      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Try calling dataGridView1->Refresh() after you add the data.

      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