示例#1
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                DataGridViewRow data = dataGridView1.Rows[e.RowIndex];
                TxtIdx.Text    = data.Cells[0].Value.ToString();
                TxtAuthor.Text = data.Cells[1].Value.ToString();

                CboDivision.SelectedIndex = CboDivision.FindString(data.Cells[2].Value.ToString());
                //CboDivision.SelectedValue = data.Cells[2].Value;

                TxtNames.Text = data.Cells[3].Value.ToString();

                DtpReleaseDate.CustomFormat = "yyyy-MM-dd";
                DtpReleaseDate.Format       = DateTimePickerFormat.Custom;
                DtpReleaseDate.Value        = DateTime.Parse(data.Cells[4].Value.ToString());

                TxtIsbn.Text  = data.Cells[5].Value.ToString();
                TxtPrice.Text = data.Cells[6].Value.ToString();

                TxtIdx.ReadOnly = true;

                myMode = BaseMode.UPDATE;
            }
        }
示例#2
0
        private void GrdDivTbl_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                DataGridViewRow data = GrdBooksTbl.Rows[e.RowIndex];
                TxtIdx.Text               = data.Cells[0].Value.ToString();
                TxtAuthor.Text            = data.Cells[1].Value.ToString();
                CboDivision.SelectedIndex = CboDivision.FindString(data.Cells[2].Value.ToString());
                // "로맨스" , "SF/판타지"
                //CboDivision.SelectedIndex = CboDivision.FindString(data.Cells[3].Value.ToString());
                // "B001" , "B006"
                CboDivision.SelectedValue = data.Cells[2].Value;

                TxtNames.Text = data.Cells[4].Value.ToString();

                DtpReleaseDate.CustomFormat = "yyyy-MM-dd";
                DtpReleaseDate.Format       = DateTimePickerFormat.Custom;

                DtpReleaseDate.Value = DateTime.Parse(data.Cells[5].Value.ToString());
                TxtISBN.Text         = data.Cells[6].Value.ToString();
                TxtPrice.Text        = data.Cells[7].Value.ToString();

                TxtIdx.ReadOnly  = true;
                TxtIdx.BackColor = Color.Beige;
                mode             = "UPDATE";
            }
        }
示例#3
0
        private void GrdDivTbl_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                //Cells[3]은 inner join으로 결과를 나타내준다.
                DataGridViewRow data = GrdBooksTbl.Rows[e.RowIndex];
                TxtIdx.Text               = data.Cells[0].Value.ToString();                         // ID
                TxtIdx.ReadOnly           = true;                                                   //Division이 PK라서 변경하면 안 된다.
                TxtIdx.BackColor          = Color.Red;
                TxtAuthor.Text            = data.Cells[1].Value.ToString();                         // 저자
                CboDivision.SelectedIndex = CboDivision.FindString(data.Cells[2].Value.ToString()); // 책 장르
                TxtNames.Text             = data.Cells[4].Value.ToString();                         // 책 제목
                DtpReleaseDate.Value      = DateTime.Parse(data.Cells[5].Value.ToString());         //발간일
                TxtISBN.Text              = data.Cells[6].Value.ToString();                         // ISBN
                TxtPrice.Text             = data.Cells[7].Value.ToString();                         // 가격



                mode = "UPDATE"; // 수정은 UPDATE
            }
        }
示例#4
0
        private void GridDivTbl_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                DataGridViewRow data = GrdBooksTbl.Rows[e.RowIndex];
                TxtIdx.Text               = data.Cells[0].Value.ToString();
                TxtAuthor.Text            = data.Cells[1].Value.ToString();
                CboDivision.SelectedIndex = CboDivision.FindString(data.Cells[3].Value.ToString()); // 값을 넣고 가져올때 selectedindex 사용
                // "로맨스", "SF/판타지" 이런 글자를 string하여 index에 돌아옴
                //data.Cells[3].Value.ToString(); == join 한것은 가져올 필요 X
                TxtNames.Text = data.Cells[4].Value.ToString();

                TxtReleaseDate.CustomFormat = "yyyy-MM-dd";
                TxtReleaseDate.Format       = DateTimePickerFormat.Custom;

                TxtReleaseDate.Value = DateTime.Parse(data.Cells[5].Value.ToString());
                TxtISBN.Text         = data.Cells[6].Value.ToString();
                TxtPrice.Text        = data.Cells[7].Value.ToString();
                TxtIdx.ReadOnly      = true;
                TxtIdx.BackColor     = Color.Red;

                mode = "UPDATE";
            }
        }