:-/
hey friends i need a help urgently....
i'm doing a project where i use listbox...i'm facing problem with this
firstly i'm populating a listbox with particular field...then on clicking particular item in listbox the corresponding records from database should get displayed in all the textboxes of the form...here's a sample code which i treid but there's problem.....
after modifying or deleting particular record the first item record doesnot get displayed in textbox....plzzzz sought out my problem....

private void Form1_Load(object sender, System.EventArgs e) {
         string connString = "server=(local)\\SQLEXPRESS;database=MyDatabase;Integrated Security=SSPI";
  
         string sql = @"select firstname, lastname from employee ";

         SqlConnection conn = new SqlConnection(connString);
         SqlDataAdapter da = new SqlDataAdapter(sql, conn);
         da.Fill(dataSet1, "employee");
         DataTable dt = dataSet1.Tables["employee"];

         listBox1.DataSource = dt;
         listBox1.DisplayMember = "firstname";

         textBox1.DataBindings.Add("text", dt, "firstname");

         textBox2.DataBindings.Add("text", dt, "lastname");

      }
    }

i'm using vb.net 2003 and ms access but code is foe sql which i can convert it to oledb later....

Recommended Answers

All 2 Replies

First of all it's VB.NET forum you should put your question on C# forum.
Get us the code which you delete\update records by.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.