I want to get all values from from datagridview and set 2D double array.I have tried alot of syntax but it not works. Here is the code and it gives access violation exception during converting .
public ref class Form1 : public System::Windows::Forms::Form
{
int **KillRatetemp;
double **Costtemp;
public:
Form1(void)
{
InitializeComponent();
KillRatetemp=new int*[26];
Costtemp=new double*[26];
for(int i=0;i<26;i++)
{
KillRatetemp[i]=new int[9];
Costtemp[i]=new double[9];
}
}
void SetValues()
{
dataGridView1->Rows->Add(27);
dataGridView2->Rows->Add(27);
for(int i=0;i<=26;i++)
{
for(int j=0;j<=9;j++)
{
dataGridView1->Rows[i]->Cells[j]->Value="1";
dataGridView2->Rows[i]->Cells[j]->Value="1";
}
}
//It works with i<26,j<9
for(int i=0;i<=26;i++)
{
for(int j=0;j<=9;j++)
{
Costtemp[i][j]= System::Convert::ToDouble(dataGridView1->Rows[i]->Cells[j]->Value);
KillRatetemp[i][j]= System::Convert::ToDouble(dataGridView2->Rows[i]->Cells[j]->Value);
}
}
};
Afterwards i want to place the 2D array again in Datagridview. I am using Visual Studio 2010 Windows Form Application,Pure MSIL common Language Runtime Support. Kindly solve my problem .Thanks in advance
从int类型到Double类型的转换
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.