Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

DataGridView i TextBox

[es] :: .NET :: .NET Desktop razvoj :: DataGridView i TextBox

[ Pregleda: 1265 | Odgovora: 3 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

AMD guy
Miroslav
.NET developer

Član broj: 128930
Poruke: 1007

Sajt: www.its.edu.rs


+38 Profil

icon DataGridView i TextBox24.04.2010. u 19:26 - pre 170 meseci
Punim DataGridView preko DataSet-a

Code (csharp):
//DataAccessLayer
 public DataSet SelectAll()
        {
            try
            {
                Database db = DatabaseFactory.CreateDatabase();
                DbCommand SellectAll = db.GetStoredProcCommand("ListajSveKorisnike");

                DataSet dsResult = db.ExecuteDataSet(SellectAll);

                return dsResult;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
//BLL
 public DataSet SelectAllKorisnici()
        {
            return Dal.SelectAll();
        }
//Forma sa gridom
            BAL bll = new BAL();
            DataSet dsListajKorisnike = bll.SelectAllKorisnici();
            dataGridView1.DataSource = dsListajKorisnike.Tables[0];
 

Moje pitanje je:
Kako da bindujem textboxove na toj istoj fomi, probao sam sa textbox.databinding ali ne znam tacno kako to radi, isto tako izbegavam binding wizard samo hocu preko koda.

Hvala unapred.
http://i.imgur.com/V3feW.jpg
http://on.wsj.com/H9yjz6 -- India Graduates Millions, but Too Few Are Fit to Hire
 
Odgovor na temu

AMD guy
Miroslav
.NET developer

Član broj: 128930
Poruke: 1007

Sajt: www.its.edu.rs


+38 Profil

icon Re: DataGridView i TextBox24.04.2010. u 20:42 - pre 170 meseci
Pronasao sam resenje, koga interesuje
Code (csharp):
//Forma grida
BAL bll = new BAL();
            DataSet dsListajKorisnike = bll.SelectAllKorisnici();
            dataGridView1.DataSource = dsListajKorisnike.Tables[0];
           dsListajKorisnike.Tables[0].TableName = "Korisnici"; //Imenujem tabelu u datasetu
            tbIme.DataBindings.Add("Text", dsListajKorisnike, "Korisnici.Ime");

http://i.imgur.com/V3feW.jpg
http://on.wsj.com/H9yjz6 -- India Graduates Millions, but Too Few Are Fit to Hire
 
Odgovor na temu

AMD guy
Miroslav
.NET developer

Član broj: 128930
Poruke: 1007

Sajt: www.its.edu.rs


+38 Profil

icon Re: DataGridView i TextBox24.04.2010. u 20:52 - pre 170 meseci
Novi problem sa time.
Bindovanje vazi samo prvi red, ako ima vise unosa u Gridu prikazuju se samo vrednosti iz prvog reda, ne znam kako da se menjaju vrednosti TextBox-a u skladu sa selektovanim celijama grida.

http://i.imgur.com/V3feW.jpg
http://on.wsj.com/H9yjz6 -- India Graduates Millions, but Too Few Are Fit to Hire
 
Odgovor na temu

AMD guy
Miroslav
.NET developer

Član broj: 128930
Poruke: 1007

Sajt: www.its.edu.rs


+38 Profil

icon Re: DataGridView i TextBox24.04.2010. u 22:52 - pre 170 meseci
Resio i taj problem

Code (csharp):
BAL bll = new BAL();
            DataSet dsListajKorisnike = bll.SelectAllKorisnici();
            BindingSource bind = new BindingSource();
           
            bind.DataSource = dsListajKorisnike.Tables[0];
            dataGridView1.DataSource = bind;                      
           
           
            tbIme.DataBindings.Add("Text", bind, "Ime");
            tbPrezime.DataBindings.Add("Text", bind, "Prezime");
            tbAdresa.DataBindings.Add("Text", bind, "Adresa");
            tbTelefon.DataBindings.Add("Text", bind, "Telefon");

http://i.imgur.com/V3feW.jpg
http://on.wsj.com/H9yjz6 -- India Graduates Millions, but Too Few Are Fit to Hire
 
Odgovor na temu

[es] :: .NET :: .NET Desktop razvoj :: DataGridView i TextBox

[ Pregleda: 1265 | Odgovora: 3 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.