473,791 Members | 3,277 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Connectio n, rst As New ADODB.Recordset

cnt.Open "Provider=Micro soft.Jet.OLEDB. 4.0;" & _
"Data Source=\\GCD01F 4500\DATI\PUBBL ICA\INPS_WEB\US ER.MDB;"
rst.Open "SELECT CAUSALI FROM SERVIZIO ORDER BY CAUSALI", cnt

Do Until rst.EOF
ComboBox1.AddIt em rst.Fields("CAU SALI")
rst.MoveNext
Loop

Set rst = Nothing
Set cnt = Nothing

End Sub

tia.

Aug 30 '06 #1
1 1278
Gss,

If you don't use Ado but AdoNet it is very simple

\\\
Dim Conn as new OleDB.OleDBconn ection("TheConn ectionString)
dim ad as new OleDb.OleDBData Adapter("TheSel ectString",Conn )
dim dt as new datatable
ad.fill(dt)
combobox1.DataS ource = dt.defaultview
combobox1.Displ aymember = "TheFieldYouWan tToDisplay"
combobox1.Value member = "TheFieldYouWan tToUse"
///

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******** *************@i 42g2000cwa.goog legroups.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.Connectio n, rst As New ADODB.Recordset

cnt.Open "Provider=Micro soft.Jet.OLEDB. 4.0;" & _
"Data Source=\\GCD01F 4500\DATI\PUBBL ICA\INPS_WEB\US ER.MDB;"
rst.Open "SELECT CAUSALI FROM SERVIZIO ORDER BY CAUSALI", cnt

Do Until rst.EOF
ComboBox1.AddIt em rst.Fields("CAU SALI")
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
1946
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: TEXT VALUE Category1 10
1
15033
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 data from a collection. Then, I want to bind that list to a member of a custom class. (Don't ask why, just trust me on that one. <gr>). What I'm doing now is binding the combo box to a collection, as follows: Dim items As ArmorTypeCollection =...
6
7811
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 the item count correctly
2
6953
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 list of different categories. The category is stored as a number and the item is stored as a string. Also once the item is picked from the list I would also like to extract the price corresponding to the chosen item. This program will be to...
6
1707
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. 1) If I connect each combobox to one Dataset then if I choose street in one combobox it changes also in combobox 2 and 3. So one dataset to three comboboxes is bad idea, isn't it? But filling one dataset is fast.
3
1503
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 know combo1.items.add(Item) But what I don't get is how to assign both the text and value at the same
18
20232
by: Vayse | last post by:
Has anyone an example of filling a combo box with a data reader? Thanks Vayse
3
6732
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 bound to. The datatable in the dataset is filled using the typed tableadapter (TableAdapter1). DataTable consists of the typical primary key and value fields. Here is the designer generated code for ComboBox1: this.ComboBox1.DataSource =...
5
22584
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 "Monday" comboX.ItemData (comboX.NewIndex) = 1 comboX.text = ComboX.List(0) where:
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10428
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10207
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10156
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9997
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7537
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5435
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.