0

私は2つのフォームを持っています..gridFormdataGridViewデータベースからデータを取得します.2番目のフォームeditFormはにtextboxes似ていgridView Columnsます.

行を選択してからgrid編集ボタンをクリックすると、editForm表示される必要があり、テキストボックスにはグリッドからの値が含まれます

グリッドフォーム

private void dataGridView1_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
    {
        if (e.RowIndex >= 0)
        {
            DataGridViewRow row = dataGridView1.Rows[e.RowIndex];

            // when i put this line only , it works right.
            edditContactForm.edditContactNameSetter = row.Cells["contactNameGridViewColumn"].Value.ToString();

            // this also with the previous is working right too.
            edditContactForm.edditJobTitleSetter = row.Cells["jobTitleGridViewColumn"].Value.ToString();

            // the problem appears here and the exhibition shown to this line and any similar lines under it. 
            edditContactForm.edditCompanyNameSetter = row.Cells["CompanyNameGridViewColumn"].Value.ToString();
        }
    }

編集フォーム:

    public string edditContactNameSetter 
    {
        set { txtContactName.Text = value; }
    }

    public string edditJobTitleSetter
    {
        set { txtJobTitle.Text = value; }
    }

    public string edditCompanyNameSetter
    {
        set { txtCompanyName.Text = value; }
    }

エキシビション:

グリッドから任意の行を選択すると、展示が表示されます ここに画像の説明を入力

4

1 に答える 1