예제 #1
0
        private void DataGridViewUsers_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewUsers.Rows[e.RowIndex].Selected = true;                                                    //koji je retka je kliknut, klikom na gumbic u odredenom retku taj redat bude selektiran, redak se zaplavi n stuff
            if (DataGridViewUsers.CurrentCell.ColumnIndex.Equals(5) && e.RowIndex != -1)                           //ako je index trenutne celije jednak 5(broj kolona,krece od  0) i ako index retka nije -1 onda ide radnja
            {
                FormEditUser FormEditUser = new FormEditUser(this);                                                //kreiraj novu formu yo;this salje sam sebe drugoj formi, this je objekt prve forme
                FormEditUser.lblEditUserID.Text    = DataGridViewUsers.Rows[e.RowIndex].Cells[0].Value.ToString(); //upuca text u labelu iz pritisnutog retka
                FormEditUser.lblEditUsername.Text  = DataGridViewUsers.Rows[e.RowIndex].Cells[1].Value.ToString();
                FormEditUser.inptEditPassword.Text = DataGridViewUsers.Rows[e.RowIndex].Cells[2].Value.ToString();
                FormEditUser.inptEditName.Text     = DataGridViewUsers.Rows[e.RowIndex].Cells[3].Value.ToString();
                FormEditUser.inptEditSurname.Text  = DataGridViewUsers.Rows[e.RowIndex].Cells[4].Value.ToString();
                FormEditUser.Show();//prikazi formu yo
            }

            if (DataGridViewUsers.CurrentCell.ColumnIndex.Equals(6) && e.RowIndex != -1)
            {
                FormDeleteUser FormDeleteUser = new FormDeleteUser(this);
                FormDeleteUser.ID       = DataGridViewUsers.Rows[e.RowIndex].Cells[0].Value.ToString();
                FormDeleteUser.Username = DataGridViewUsers.Rows[e.RowIndex].Cells[1].Value.ToString();
                FormDeleteUser.Password = DataGridViewUsers.Rows[e.RowIndex].Cells[2].Value.ToString();
                FormDeleteUser.Name     = DataGridViewUsers.Rows[e.RowIndex].Cells[3].Value.ToString();
                FormDeleteUser.Surname  = DataGridViewUsers.Rows[e.RowIndex].Cells[4].Value.ToString();
                FormDeleteUser.Show();
            }
        }
예제 #2
0
 private void dataGridViewUsers_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     //MessageBox.Show("Yello!"); //pop-up box-ić
     dataGridViewUsers.Rows[e.RowIndex].Selected = true;  //broj retka u kojem se nalazimo, redak u kojem smo pritisnuli gumb postaje onaj označeni redak (selektiran)
     if (dataGridViewUsers.CurrentCell.ColumnIndex.Equals(5) && e.RowIndex != -1)
     {
         /*ako mi redak nije -1 neka radnja se izvršava, čelija, wtf*/
         FormEditUser FormEditUser = new FormEditUser(this);                                                //stvara se forma FormEditUser (objekt klase feu) za kreiranje korisnika
         FormEditUser.lblEditID.Text        = dataGridViewUsers.Rows[e.RowIndex].Cells[0].Value.ToString(); //postavljanje teksta u labeli forme 2
         FormEditUser.lblEditUsername.Text  = dataGridViewUsers.Rows[e.RowIndex].Cells[1].Value.ToString(); //korisničko ime čelija 2
         FormEditUser.inptEditPassword.Text = dataGridViewUsers.Rows[e.RowIndex].Cells[2].Value.ToString(); //lozinka čelija 3
         FormEditUser.inptEditName.Text     = dataGridViewUsers.Rows[e.RowIndex].Cells[3].Value.ToString(); //ime čelija 4
         FormEditUser.inptEditSurname.Text  = dataGridViewUsers.Rows[e.RowIndex].Cells[4].Value.ToString(); //prezime čelija 5
         //kupimo vrijednosti iz tablice u prvoj formi i stavljamo ih uz pripadajuće čelije u drugoj formi
         FormEditUser.Show();
     }
     if (dataGridViewUsers.CurrentCell.ColumnIndex.Equals(6) && e.RowIndex != -1)
     {
         DeleteUser FormDeleteUser = new DeleteUser(this);
         FormDeleteUser.ID       = dataGridViewUsers.Rows[e.RowIndex].Cells[0].Value.ToString();
         FormDeleteUser.Username = dataGridViewUsers.Rows[e.RowIndex].Cells[1].Value.ToString();
         FormDeleteUser.Password = dataGridViewUsers.Rows[e.RowIndex].Cells[2].Value.ToString();
         FormDeleteUser.Name     = dataGridViewUsers.Rows[e.RowIndex].Cells[3].Value.ToString();
         FormDeleteUser.Surname  = dataGridViewUsers.Rows[e.RowIndex].Cells[4].Value.ToString();
         FormDeleteUser.Show();
     }
 }
예제 #3
0
        private void dataGridViewUsers_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            //  MessageBox.Show("Dot Net"); -- provjera jel radi

            dataGridViewUsers.Rows[e.RowIndex].Selected = true;                          // redak na koji sam pritisnuo dugmic se selectira cijeli redak.
            if (dataGridViewUsers.CurrentCell.ColumnIndex.Equals(5) && e.RowIndex != -1) // ako mi je moja trenuta celija ( index =5--broj kolone ) i ako index retka nije -1(mora biti index) nesto napravi
            {
                FormEditUser FormEditUser = new FormEditUser(this);                      //this pokazivac na objekt 1.forme-->prosljedujemo parametar
                FormEditUser.lblEditUserID.Text    = dataGridViewUsers.Rows[e.RowIndex].Cells[0].Value.ToString();
                FormEditUser.lblEditUserName.Text  = dataGridViewUsers.Rows[e.RowIndex].Cells[1].Value.ToString();
                FormEditUser.inptEditPassword.Text = dataGridViewUsers.Rows[e.RowIndex].Cells[2].Value.ToString();
                FormEditUser.inptEditName.Text     = dataGridViewUsers.Rows[e.RowIndex].Cells[3].Value.ToString();
                FormEditUser.inptEditSurname.Text  = dataGridViewUsers.Rows[e.RowIndex].Cells[4].Value.ToString();
                FormEditUser.Show();
            }
            if (dataGridViewUsers.CurrentCell.ColumnIndex.Equals(6) && e.RowIndex != -1)
            {
                DeleteUser FormDeleteUser = new DeleteUser(this);
                FormDeleteUser.ID       = dataGridViewUsers.Rows[e.RowIndex].Cells[0].Value.ToString();
                FormDeleteUser.Username = dataGridViewUsers.Rows[e.RowIndex].Cells[1].Value.ToString();
                FormDeleteUser.Password = dataGridViewUsers.Rows[e.RowIndex].Cells[2].Value.ToString();
                FormDeleteUser.Name     = dataGridViewUsers.Rows[e.RowIndex].Cells[3].Value.ToString();
                FormDeleteUser.Surname  = dataGridViewUsers.Rows[e.RowIndex].Cells[4].Value.ToString();
                FormDeleteUser.Show();
            }
        }
예제 #4
0
        }                                                                                           //da to nemamo kolona nam bi bila na sredini stranice

        private void DataGridViewUsers_CellContentClick(object sender, DataGridViewCellEventArgs e) //parametar ove funkcije je e- event da znamo koju smo celiju stisnili
        {
            // MessageBox.Show("Gumbić");
            DataGridViewUsers.Rows[e.RowIndex].Selected = true; // tu se postavlja da je redak
            if (DataGridViewUsers.CurrentCell.ColumnIndex.Equals(5) && e.RowIndex != -1)
            {
                //this- je objekt prve forme, ako necemo da pise this mogli smo ovako:
                //form1 FormUserList =this; i onda staviti tu ispod.
                FormEditUser FormEditUser = new FormEditUser(this);                                                //kreiraj mi novu formu za editiranje usera , this. je sam svoj objekt salje sebe u iz 1.forme u 2.formu, objekt klase form edit user ciji konsttrukot
                FormEditUser.lblEditUserID.Text    = DataGridViewUsers.Rows[e.RowIndex].Cells[0].Value.ToString(); //imamo datagridview znamo na koji smo redak stisnili zbog e-eventa, kolonu citamo kod cells[0] indeks
                FormEditUser.lblEditUserName.Text  = DataGridViewUsers.Rows[e.RowIndex].Cells[1].Value.ToString();
                FormEditUser.inptEditPassword.Text = DataGridViewUsers.Rows[e.RowIndex].Cells[2].Value.ToString();
                FormEditUser.inptEditName.Text     = DataGridViewUsers.Rows[e.RowIndex].Cells[3].Value.ToString();
                FormEditUser.inptEditSurname.Text  = DataGridViewUsers.Rows[e.RowIndex].Cells[4].Value.ToString();
                FormEditUser.Show(); // prikazi mi formu
            }

            if (DataGridViewUsers.CurrentCell.ColumnIndex.Equals(6) && e.RowIndex != -1)
            {
                Form3 Form3 = new Form3(this);
                Form3.ID = DataGridViewUsers.Rows[e.RowIndex].Cells[0].Value.ToString();

                /* Form3.Name = DataGridViewUsers.Rows[e.RowIndex].Cells[1].Value.ToString();
                 * Form3.Surname = DataGridViewUsers.Rows[e.RowIndex].Cells[2].Value.ToString();
                 * Form3.Password = DataGridViewUsers.Rows[e.RowIndex].Cells[3].Value.ToString();
                 * Form3.Username = DataGridViewUsers.Rows[e.RowIndex].Cells[4].Value.ToString();*/
                Form3.Show();
            }
        }
예제 #5
0
        private void DataGridViewUsers_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            //metoda za provjeravanje da li se poziva funkcija klikom na gumb
            //MessageBox.Show("Dot Net");

            DataGridViewUsers.Rows[e.RowIndex].Selected = true; //tu se postavlja da se redak zaplavi

            //ako je index kliknute ćelije (kolone) 5 i index retka različit od -1, napravi nešto
            if (DataGridViewUsers.CurrentCell.ColumnIndex.Equals(5) && e.RowIndex != -1)
            {
                //Form1 FormUserList=this;
                FormEditUser FormEditUser = new FormEditUser(this);  //kreiran novi objekt druge forme(edit user) - this-pokazivač na objekt prve forme
                //new FormEditUser(this ) -objekt klase formedituser čiji konstruktor zaprima objekt klase formedituser
                FormEditUser.lblEditUserID.Text = DataGridViewUsers.Rows[e.RowIndex].Cells[0].Value.ToString();
                //iz dataviewgrid kontrole edituserid iz reda koji je pritisnut i ćelije
                //objekti kojima mijenjamo vrijednost moraju biti u formi2.designer postavljeni kao public (po defaultu je private)
                FormEditUser.lblEditUserName.Text  = DataGridViewUsers.Rows[e.RowIndex].Cells[1].Value.ToString();
                FormEditUser.inptEditPassword.Text = DataGridViewUsers.Rows[e.RowIndex].Cells[2].Value.ToString();
                FormEditUser.inptEditName.Text     = DataGridViewUsers.Rows[e.RowIndex].Cells[3].Value.ToString();
                FormEditUser.inptEditSurname.Text  = DataGridViewUsers.Rows[e.RowIndex].Cells[4].Value.ToString();
                FormEditUser.Show();
            }

            if (DataGridViewUsers.CurrentCell.ColumnIndex.Equals(6) && e.RowIndex != -1)
            {
                //Form1 FormUserList=this;
                FormDeleteUser FormDeleteUser = new FormDeleteUser(this); //kreiran novi objekt druge forme(edit user) - this-pokazivač na objekt prve forme
                //new FormEditUser(this ) -objekt klase formedituser čiji konstruktor zaprima objekt klase formedituser
                FormDeleteUser.lblDeleteuserID.Text = DataGridViewUsers.Rows[e.RowIndex].Cells[0].Value.ToString();
                FormDeleteUser.ID = DataGridViewUsers.Rows[e.RowIndex].Cells[0].Value.ToString();
                FormDeleteUser.Show();
            }
        }
예제 #6
0
 private void dataGridViewUsers_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     //MessageBox.Show("Dot net");
     dataGridViewUsers.Rows[e.RowIndex].Selected = true;
     if (dataGridViewUsers.CurrentCell.ColumnIndex.Equals(5) && e.RowIndex != -1)
     {
         Form1        FormUserList = this;
         FormEditUser FormEditUser = new FormEditUser(this);
         FormEditUser.lblEditUserID.Text =
             dataGridViewUsers.Rows[e.RowIndex].Cells[0].Value.ToString();
         FormEditUser.lblEditUserName.Text =
             dataGridViewUsers.Rows[e.RowIndex].Cells[1].Value.ToString();
         FormEditUser.inptEditPassword.Text =
             dataGridViewUsers.Rows[e.RowIndex].Cells[2].Value.ToString();
         FormEditUser.inptEditName.Text =
             dataGridViewUsers.Rows[e.RowIndex].Cells[3].Value.ToString();
         FormEditUser.inptEditSurname.Text =
             dataGridViewUsers.Rows[e.RowIndex].Cells[4].Value.ToString();
         FormEditUser.Show();
     }
     if (dataGridViewUsers.CurrentCell.ColumnIndex.Equals(6) && e.RowIndex != -1)
     {
         DeleteUser FormDeleteUser = new DeleteUser(this);
         FormDeleteUser.nID       = dataGridViewUsers.Rows[e.RowIndex].Cells[0].Value.ToString();
         FormDeleteUser.sUsername = dataGridViewUsers.Rows[e.RowIndex].Cells[1].Value.ToString();
         FormDeleteUser.sPassword = dataGridViewUsers.Rows[e.RowIndex].Cells[2].Value.ToString();
         FormDeleteUser.sName     = dataGridViewUsers.Rows[e.RowIndex].Cells[3].Value.ToString();
         FormDeleteUser.sSurname  = dataGridViewUsers.Rows[e.RowIndex].Cells[4].Value.ToString();
         FormDeleteUser.Show();
     }
 }
예제 #7
0
 private void DataGridViewUsers_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     //MessageBox.Show("Dot Net");
     DataGridViewUsers.Rows[e.RowIndex].Selected = true;
     if (DataGridViewUsers.CurrentCell.ColumnIndex.Equals(5) && e.RowIndex != -1)
     {
         FormEditUser FormEditUser = new FormEditUser(this); // kreiran novi objekt druge forme, this pokazivać na prvu formu, poziva se funkcija konstruktor, a to je public formedituser u kojoj smo zaprili prvu formu i podatkovni član smo postavili na objekt kojeg smo primili.
         FormEditUser.lblEditUserID.Text    = DataGridViewUsers.Rows[e.RowIndex].Cells[0].Value.ToString();
         FormEditUser.lblEditUserName.Text  = DataGridViewUsers.Rows[e.RowIndex].Cells[1].Value.ToString();
         FormEditUser.inptEditPassword.Text = DataGridViewUsers.Rows[e.RowIndex].Cells[2].Value.ToString();
         FormEditUser.inptEditName.Text     = DataGridViewUsers.Rows[e.RowIndex].Cells[3].Value.ToString();
         FormEditUser.inptEditSurname.Text  = DataGridViewUsers.Rows[e.RowIndex].Cells[4].Value.ToString();
         FormEditUser.Show();
     }
 }
예제 #8
0
 private void dataGridViewUsers_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     dataGridViewUsers.Rows[e.RowIndex].Selected = true;
     if (dataGridViewUsers.CurrentCell.ColumnIndex.Equals(5) && e.RowIndex != -1)
     {
         FormEditUser FormEditUser = new FormEditUser(this);
         FormEditUser.lblEditUserID.Text    = dataGridViewUsers.Rows[e.RowIndex].Cells[0].Value.ToString();
         FormEditUser.lblEditUserName.Text  = dataGridViewUsers.Rows[e.RowIndex].Cells[1].Value.ToString();
         FormEditUser.inptEditPassword.Text = dataGridViewUsers.Rows[e.RowIndex].Cells[2].Value.ToString();
         FormEditUser.inptEditName.Text     = dataGridViewUsers.Rows[e.RowIndex].Cells[3].Value.ToString();
         FormEditUser.inptEditSurname.Text  = dataGridViewUsers.Rows[e.RowIndex].Cells[4].Value.ToString();
         FormEditUser.Show();
     }
     if (dataGridViewUsers.CurrentCell.ColumnIndex.Equals(6) && e.RowIndex != -1)
     {
         FormDeleteUser FormDeleteUser = new FormDeleteUser(this);
         FormDeleteUser.ID        = dataGridViewUsers.Rows[e.RowIndex].Cells[0].Value.ToString();
         FormDeleteUser.UserName  = dataGridViewUsers.Rows[e.RowIndex].Cells[1].Value.ToString();
         FormDeleteUser.Password  = dataGridViewUsers.Rows[e.RowIndex].Cells[2].Value.ToString();
         FormDeleteUser.FirstName = dataGridViewUsers.Rows[e.RowIndex].Cells[3].Value.ToString();
         FormDeleteUser.Surname   = dataGridViewUsers.Rows[e.RowIndex].Cells[4].Value.ToString();
         FormDeleteUser.Show();
     }
 }