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
Private Sub txtnumSent_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtnumSent.TextChanged
cbbnumwaste.items.clear()
Dim i As Integer
For i = 1 To numi
cbbnumwaste.Items.Add(i)
Next
End Sub
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