Wilder1626
asked on
Add Items to Combobox VB 2010
Hello all,
I have another issue when i want to add items in my combobox. If is feed by the link in my Parametre.txtBaseDelabsolu tion.Text.
This is the error:
Error 2 'AddItem' is not a member of 'System.Windows.Forms.Comb oBox'.
Thanks again for you help
I have another issue when i want to add items in my combobox. If is feed by the link in my Parametre.txtBaseDelabsolu
This is the error:
Error 2 'AddItem' is not a member of 'System.Windows.Forms.Comb
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Nom de famille
Dim sSQL3 As String
Dim oConnect3 As ADODB.Connection
oConnect3 = New ADODB.Connection
Dim oRST3 As ADODB.Recordset
oRST3 = New ADODB.Recordset
sSQL3 = "SELECT DISTINCT[nom]FROM [Clients]'"
oConnect3.Open("Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & Parametre.txtBaseDelabsolution.Text)
Me.Nom_famille.AddItem("")
oRST3.Open(sSQL3, oConnect3)
Do Until oRST3.EOF
Me.Nom_famille.AddItem(oRST3("Nom"))
oRST3.MoveNext()
Loop
End Sub
Thanks again for you help
a good link on the differences between vb6 and vb2010 :
http://msdn.microsoft.com/ en-us/libr ary/fte6kb t2(v=vs.80 ).aspx
http://msdn.microsoft.com/
ASKER
Hello,
Now it feeds my combobox but not with what i'm suppose to.
I have full list of: ADODB.InternalField.
What could it be?
Now it feeds my combobox but not with what i'm suppose to.
I have full list of: ADODB.InternalField.
What could it be?
Hmm didn't notice before but looks like you are trying to use ADO rather than ADO.Net have a look at the link below for an overview of retrieving records from a database using ado.net:
http://asp.dotnetheaven.co m/howto/do c/adoplus/ sqldtreade r.aspx
http://asp.dotnetheaven.co
ASKER
What is the diffrence?
What i could say is that i was using the code in my first post with VB6 with a data base from Microsoft Access 2007.
What i could say is that i was using the code in my first post with VB6 with a data base from Microsoft Access 2007.
But you are using VB.net now ?
anyway i think you can change your existing code as follows by adding a .movefirst before the loop. I suggest you do look into ado.net as it hadles disconnected recordsets like you are trying to do above better and more efficiently.
anyway i think you can change your existing code as follows by adding a .movefirst before the loop. I suggest you do look into ado.net as it hadles disconnected recordsets like you are trying to do above better and more efficiently.
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Nom de famille
Dim sSQL3 As String
Dim oConnect3 As ADODB.Connection
oConnect3 = New ADODB.Connection
Dim oRST3 As ADODB.Recordset
oRST3 = New ADODB.Recordset
sSQL3 = "SELECT DISTINCT[nom]FROM [Clients]'"
oConnect3.Open("Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & Parametre.txtBaseDelabsolution.Text)
Me.Nom_famille.AddItem("")
oRST3.Open(sSQL3, oConnect3)
If Not oRST3.EOF Then
oRST3.MoveFirst
Do Until oRST3.EOF
Me.Nom_famille.AddItem(oRST3("Nom"))
oRST3.MoveNext()
Loop
End If
End Sub
ASKER
I have tried your code above but i have the same result with: ADODB.InternalField.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This is perfect.
Thanks for your help.
Thanks for your help.
You need to use Me.Nom_famille.Items.Add(o