473,403 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

fill combobox1...

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.MD B;"
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.

Aug 30 '06 #1
1 1251
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

<gs*******@iol.itschreef in bericht
news:11*********************@i42g2000cwa.googlegro ups.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.MD B;"
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.

Aug 31 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Pepehammer | last post by:
Hi everybody! I got a combobox to fill. I want to display some information (Text), but when I select a item, I want to return a number. The info I want to fill in is something like this: ...
1
by: Mike Hofer | last post by:
I am trying to do something a little nonstandard, and am having some difficulty determining (a) if it can be done and (b) if so, how to do it. What I want to do is fill a dropdown combobox with...
6
by: Sakharam Phapale | last post by:
Hi All, How to fill one ComboBox from other ComboBox control? 1) Only setting the reference does the trick but doesn't show items in control. If you see in immediate window, it shows...
2
by: Jeremy Dillinger | last post by:
I have a program setup to pull data from a database. My database table has things such as (category, Item, price, etc.) In my program I want to have multiple list boxes that will have a pull down...
6
by: chreo | last post by:
Sorry for weird title and sorry for my English (I'm from Poland). This is the problem: I have form with many controls. There are three comboboxes - each should have table STREETS as DataSource....
3
by: Roger | last post by:
I want to fill a combo box with a Text value to show like name, but when it is selected I want to get the say SS# or Emp #. I will be filling this in manually how should I go about this. I...
18
by: Vayse | last post by:
Has anyone an example of filling a combo box with a data reader? Thanks Vayse
3
by: Magnus | last post by:
Im using a set combobox (ComboBox1) to provide a selection of records from a database table. I have a typed dataset (DataSet1) that contains the typed datatable (DataTable1) that the combobox is...
5
by: Tark Siala | last post by:
hi dear i'm programmer with VB6, but now i starting with C#. first problem is coming when i need fill "ComboBox Control", as you know when i fill combobox in VB6 by this code: comboX.AddItem...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.