|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
fill combobox1...comobox1 with data. How to convert in VB.NET? here the code in vb classic: Sub CARICA_COMBO() Dim cnt As New ADODB.Connection, rst As New ADODB.Recordset cnt.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=\\GCD01F4500\DATI\PUBBLICA\INPS_WEB\USER.MDB;" rst.Open "SELECT CAUSALI FROM SERVIZIO ORDER BY CAUSALI", cnt Do Until rst.EOF ComboBox1.AddItem rst.Fields("CAUSALI") rst.MoveNext Loop Set rst = Nothing Set cnt = Nothing End Sub tia. Gss,
If you don't use Ado but AdoNet it is very simple \\\ Dim Conn as new OleDB.OleDBconnection("TheConnectionString) dim ad as new OleDb.OleDBDataAdapter("TheSelectString",Conn) dim dt as new datatable ad.fill(dt) combobox1.DataSource = dt.defaultview combobox1.Displaymember = "TheFieldYouWantToDisplay" combobox1.Valuemember = "TheFieldYouWantToUse" /// There is nothing to set to nothing or to dispose or whatever, that is done automatic by the Garbage Collector, which is the reason that the name is managed code. This is just typed in the message so watch errors. I hope this helps, Cor <gss.it***@iol.it> schreef in bericht Show quoteHide quote news:1156973542.182978.65130@i42g2000cwa.googlegroups.com... >i use Call CARICA_COMBO in ACTIVATE FORM (in vb classic) to fill a > comobox1 with data. > > How to convert in VB.NET? > > here the code in vb classic: > > Sub CARICA_COMBO() > > Dim cnt As New ADODB.Connection, rst As New ADODB.Recordset > > cnt.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ > "Data Source=\\GCD01F4500\DATI\PUBBLICA\INPS_WEB\USER.MDB;" > rst.Open "SELECT CAUSALI FROM SERVIZIO ORDER BY CAUSALI", cnt > > Do Until rst.EOF > ComboBox1.AddItem rst.Fields("CAUSALI") > rst.MoveNext > Loop > > Set rst = Nothing > Set cnt = Nothing > > End Sub > > tia. >
DataGridView and ComboBox
FOR ALL - Best Practices for navigating within code? -plus - Add-In's that help? Where can we buy VB.net? How Microsoft does it? Multiple icons into 1 exe or dll how to get parent control of the context menu stip crystal report question Sending email from Windows application Not working. Service station petrol pump interface show something while loading .Net framework |
|||||||||||||||||||||||