Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi everyone!

I have a datagridview and I want to automatically fill it

Let me explain: I have a matrix (gainMatrix) and I want to fill my datagridview by the latter, here is a piece of code that I use for filling:
C++
for (int i =0; i <ala.size(); i++ )
        {
            for (int j=0; j<ala[i].m_nodes.size(); j++) 
            {
                pied++;
                string f=ala[i].m_nodes[j];
                cout<<"f="<<f<<endl;
                vector<int>naoufal = reader2.distance_calculation(ala[i], f);
     
                for( int a =0; a <naoufal.size(); a++ )
                {
                int Number=naoufal[a];
                string g = static_cast<ostringstream*>( &(ostringstream() << Number) )->str();
                String^ Cell2= gcnew String(g.c_str());
 
                array<String^>^row1 = gcnew array<String^>{
                Cell2
                    };
                    array<Object^>^rows = {row1};
                      System::Collections::IEnumerator^ myEnum = rows->GetEnumerator();
                      while ( myEnum->MoveNext() )
                      {
                         array<String^>^rowArray = safe_cast<array<String^>^>(myEnum->Current);     
                         dataGridView3->Rows->Add( rowArray );
                      }
                         
                 }
            }
        }

what I want is to fill all the elements naoufal for example in the first iteration in the first line of the datagridview and this code does not help me, it shows me each element of the vector naoufal in a row :/

I do not know what to do, or is there a method that allows me to do it.????

Thank you very much for your help
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900