473,811 Members | 3,924 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

add items in combobox at runtime from database(vb.net )

33 New Member
in vb 6.0
Dim cnview As New ADODB.connectio n
Dim rsview As New ADODB.recordset
Call connection(cnvi ew, App.Path & "\aa.mdb", "")
Call recordset(rsvie w, cnview, "SELECT id FROM emp")
With rsview
While Not .EOF
Item_cmb.AddIte m .Fields!agreeit emno
.MoveNext
Wend
End With
Set cnview = Nothing
Set rsview = Nothing

Convert in vb dot net
Oct 3 '09 #1
6 8511
tlhintoq
3,525 Recognized Expert Specialist
Did you want to ask a question along with your sample code?
Oct 3 '09 #2
prigupta2
33 New Member
yes i need source cod to add item in combo box at run time
Oct 5 '09 #3
tlhintoq
3,525 Recognized Expert Specialist
myCombo.Items.A dd(String NewItem);

The MSDN for ComboBox has good source code examples
Oct 5 '09 #4
prigupta2
33 New Member
Thanks
But i want to get data from database
Oct 6 '09 #5
susanspy
1 New Member
hello all,


i am susan here, i ve completed recently .net but i am still confusd about vb .net so any one please let me know about.

keep posting.


cheers!!!!!!!!! !!!!!
Oct 6 '09 #6
hscoder
1 New Member
try code like this :

If rs.RecordCount > 0 Then
rs.MoveFirst()
For i As Integer = 0 To rs.RecordCount - 1
cmbEmpName.item s.Add(rs.Fields ("EmployeeName" ).value)
rs.MoveNext()
Next
End If
see this:

http://www.authorcode.com/forums/top...rom-recordset/
Nov 18 '11 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1296
by: dr.p.dietz | last post by:
Hello, i've a extended combobox with own properties based on normal combobox. I create the combobox on runtime as myownControls.ownCombobox and assign datasource, displaymember, valuemember. everything is fine. But: Trying to write a value as selectedvalue to the combo
6
6060
by: Stewart Saathoff | last post by:
Hello, I would like to programatically redirect the location of a web service from the client machine. Let me explain further. This is the exact process: I would like the client to click a menu bar like Tools -> Server Address and be able to type the location of the webservice. I would then save this data to the registry and when the client works in the application, they would be making calls to the specified web service.
4
244
by: humbleFunGuy | last post by:
Private Sub writeDatabase(ByVal filePath As String, ByVal action As String) Dim cnn As SqlConnection Dim cmd As SqlCommand Dim sqlStr As String Dim connStr As String connStr = "User ID=user;Password=user;Initial Catalog=file;" _ & "Data Source=(database.server.com)" sqlStr = "insert into folderWatch values('filePath', 'action')" cnn = New SqlConnection(connStr)
1
1340
by: =?Utf-8?B?TWFyaW8=?= | last post by:
hi, i would like to add pictureboxes during runtime, but there should not be a specific variable for each picturebox becouse i don't know how much it will be. so i declared a collection referencing on one var declared as picturebox. it works fine to add the controls this way. now i would like to implement one picturebox click handle for each added picturebox and i have no idea how to do this. Friend WithEvents Device As PictureBox
0
1642
by: richardchristie | last post by:
I currently have a datagrid which contains a combobox. This combobox is late bound using a procedure which looks something like this: DepartmentDataAdapter = New SqlClient.SqlDataAdapter(strSQL, MyBase._DBConnection) DepartmentDataAdapter.Fill(_Department) DepartmentIDDataGridViewComboBoxColumn.DataSource = _Department DepartmentIDDataGridViewComboBoxColumn.ValueMember = "ID" ...
4
1710
by: Semajthewise | last post by:
Ok I looked around and could not fing what I was looking for (probably cant get keywords right) and so I will post. Please forgive me if this has been answered a billion times. Using VB.net Framework, XP, and Access I created a database in access I want to use a form from VB.net to Either add to or edit that database. (The form is finished) So on button click I want it to search the databse for a # if that number exists then create a...
3
1937
by: plonk | last post by:
Hi I'm trying to learn sql by getting a database up and running on VB.net 2008 and SQL server express. I have the database connected correctly, (i think) but when i try to add a record using this code.. Dim db As New racedataDataContext Dim newmeeting As MeetingInfo = New MeetingInfo newmeeting.Date = Today db.MeetingInfos.add(newmeeting)
1
1943
by: ton | last post by:
Hi, I want to add several textbox to my form during runtime: the code is very simple Lab = New TextBox Lab.ID = "A" & i Lab.Height = 200 Lab.Visible = True Lab.Text = "test"
0
1011
by: _nabuchodonozor | last post by:
Hi all, I've got datalist where I have some Items which I add from database. Is it possible to add two more items?? I want to add Image and label... How to do it?? Nabu
0
9604
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10644
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
10379
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...
0
10127
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
7665
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
5552
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...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
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.