comboxBox doesn't work properly

  • Thread starter Thread starter Bill Nguyen
  • Start date Start date
B

Bill Nguyen

Several comboboxes in my app are not working properly with VS2005. I ahve
both .NET 1.1 and 2.0 installed in my development PC.

Below is an example of the code. It never worked the first time when
..SelectValue is set to a certain value. 2nd or 3rd try will do! Some other
combobox worked flawlessly!

Is it a known bug that I'm not aware of?
Any suggestion is greatly appreciated.

Bill

-------------------------


Private Function AddProductClass()

Dim mSQL As String

Dim dS As DataSet

mSQL = "SELECT * from WF_ProductClass "

mSQL += " ORDER by ProductClassID "

dS = Master.MasterData.sqlSelectDataset(mSQL, "wfifuel")

cbProductClass.ValueMember = "ProductClassID"

cbProductClass.DisplayMember = "ProductClassName"

cbProductClass.DataSource = dS.Tables(0)

End Function



-- displaying---

If IsDBNull(drV.Item("productClassID")) = False Then

MsgBox(drV.Item("productClassID"))

cbProductClass.SelectedValue = drV.Item("productClassID")

Else

cbProductClass.Text = "Invalid"

End If
 
I called function AddproductClass() from Sub New then it worked. Previously,
it was called from form_Load.
Can anyone please tell me why?

Thanks

Bill

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

AddProductClass()

End Sub
 
Back
Top