منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : عرض على ليست بوكس
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
السلام عليكم 
عندي كود اريد تطبيق العرض نتيجة على لسيت بوكس وحدة
بدل تاكست بوكس 
كود :
con.Open
      Dim strsql As String
      strsql = "select id,dataa1,dataa2,dataa3 from TBLDAAT where id='" + TextBox1.Text + "'"
      Dim cmd2 As New OleDbCommand(strsql, con)
      Dim myreader As OleDbDataReader
      myreader = cmd2.ExecuteReader
      myreader.Read()
      ListBox1.Text = myreader("dataa1")
TextBox2.Text = myreader("dataa2")
TextBox3.Text = myreader("dataa3")
()con.Close
هل من احد يساعدني
كود :
     If con.State = ConnectionState.Closed Then con.Open()
       Dim strsql As String
       strsql = "select id,month1,month2,month3,month4,month5,month6,month7,month8,month9,month10,month11,month12 from TBLDAAT where id='" + TextBox7.Text + "'"
       Dim cmd2 As New OleDbCommand(strsql, con)
       Dim myreader As OleDbDataReader
       myreader = cmd2.ExecuteReader
       myreader.Read()
       ListBox1.Items.Clear()
       ListBox1.Items.Add(myreader("month1"))
       ListBox1.Items.Add(myreader("month2"))
       ListBox1.Items.Add(myreader("month3"))
       ListBox1.Items.Add(myreader("month4"))
       ListBox1.Items.Add(myreader("month5"))
       ListBox1.Items.Add(myreader("month6"))
       ListBox1.Items.Add(myreader("month7"))
       ListBox1.Items.Add(myreader("month8"))
       ListBox1.Items.Add(myreader("month9"))
       ListBox1.Items.Add(myreader("month10"))
       ListBox1.Items.Add(myreader("month11"))
       ListBox1.Items.Add(myreader("month12"))

       con.Close()
هل يمكن اختصار هذا الكود