 |
|
เรื่องของ Combobox ครับ ต้องการแอดค่าให้กับ Combobox ครับ |
|
 |
|
|
 |
 |
|
อ่านแล้วงง สงสัยยังเมาค้างยุ
ตามความเข้าใจละกันนะครับ
Code (VB.NET)
for(i = 1 to 12 )
combobox.items.add(i)
next
ใช่ตามที่ต้องการป่าวครับ
|
 |
 |
 |
 |
Date :
2014-12-03 14:02:57 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (VB.NET)
Private Sub txtgoodsname_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtgoodsname.TextChanged
strcon = "SELECT...."
ds = New DataSet
da = New SqlDataAdapter(strcon, conn)
da.Fill(ds, "GoodsImport")
For Each row As DataRow In ds.Tables("GoodsImport").Rows
txtgoodsid.Text = row("goodsID").ToString
txtgoodsname.Text = row("goodsName").ToString
txtbarcode.Text = row("barcode").ToString
txtgoodsmodel.Text = row("goodsModel").ToString
txtgoodsdetail.Text = row("goodsDetail").ToString
txtnumSent.Text = row("numSent").ToString
numi = row("numSent").ToString '<=======
Next
End Sub
โค้ดส่วนที่แอดค่าให้กับ numi ครับ
Code (VB.NET)
Private Sub txtnumSent_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtnumSent.TextChanged
Dim i As Integer
For i = 1 To numi
cbbnumwaste.Items.Add(i)
Next
Exit Sub
End Sub
โค้ดส่วน loop ครับ
|
 |
 |
 |
 |
Date :
2014-12-03 15:35:21 |
By :
nameball |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ทำไมซับซ้อนจังครับ
ไม่หา max(numSent) ทีเดียวไปเลยอ่าครับ
(รึต้องเป็นแบบนี้)
ยังไงเราก็ต้องเอาทั้งหมดออกมาใช้งานน๊
งั้นหา max(numSent) ดีกว่า
SQL ผมยิ่งไม่แข็งแรงซะด้วย
ไปแกะเอานะครับอันไหนไม่ถูก
Code (VB.NET)
Private Sub txtgoodsname_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtgoodsname.TextChanged
strcon = "SELECT...."
ds = New DataSet
da = New SqlDataAdapter(strcon, conn)
da.Fill(ds, "GoodsImport")
For Each row As DataRow In ds.Tables("GoodsImport").Rows
txtgoodsid.Text = row("goodsID").ToString
txtgoodsname.Text = row("goodsName").ToString
txtbarcode.Text = row("barcode").ToString
txtgoodsmodel.Text = row("goodsModel").ToString
txtgoodsdetail.Text = row("goodsDetail").ToString
txtnumSent.Text = row("numSent").ToString
numi = row("numSent").ToString '<=======
Next
strcon = "SELECT max(numSent) as max_numSent form ....."
ds = New DataSet
da = New SqlDataAdapter(strcon, conn)
da.Fill(ds, "GoodsImport")
numi = row("max_numSent")
cbbnumwaste.items.clear()
Dim i As Integer
For i = 1 To numi
cbbnumwaste.Items.Add(i)
Next
End Sub
txtnumSent_TextChanged ตัดออกไปเลยก็ได้ครับ
|
 |
 |
 |
 |
Date :
2014-12-03 15:56:09 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|