954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

combobox question

Hi there,

i need some help as i'm new with using comboboxes :)

i have a table in a MS access database named "CUSTOMER" and in my vb form i have a combobox (name: cmb1). I want to display the names of my customers in my combobox when the form loads and when i search the combobox and select a particular person, i want the other values in the table to be displayed in textboxes......

any ideas please??? thank you very much

lukis
Newbie Poster
14 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

hi
select cobobox and in right you will see the properties
1/datasource make its value the table in dataset you want
2/ ValueMember make its value the coulmn name (name of custeomer)

when your form load you fill dataset

Me.DataSet11.Clear()
Me.OleDbDataAdapter1.Fill(DataSet11)


now the list of comboBox has the names of ur customers

i hope this help

manal
Junior Poster
122 posts since Mar 2006
Reputation Points: 37
Solved Threads: 17
 

hi and thanks for your reply. however i have been able to do that fill. my query is this.

I have 3 textboxes on my form.
when i select the item from the combobox i need the 3 textboxes to be filled with the data corresponding to that field. ( what i'm trying to say is that i have a table in macces with 4 rows, one of them is the field chosen in the combobox. now when i select the item i want the textboxes to display the latter of the record)

thanks
lukis

lukis
Newbie Poster
14 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

hi:cheesy:
i used dataset and dataadptor for display the other data in text box
the sql query will be like this

select email , name
from customer
where id =?


then douple click in combobox and write this code (douple click means the code will excute when user select value )

'here you select the row from table with id that user choose from comboBox
OleDbDataAdapter2.SelectCommand.Parameters("ID").Value = Me.ComboBox1.Text

        Me.DataSet21.Clear()
        Me.OleDbDataAdapter2.Fill(DataSet21)

        TextBox1.Text = DataSet21.Tables("customer").Rows(0).Item("email")

        TextBox2.Text = DataSet21.Tables("customer").Rows(0).Item("name")

i hope this what u want

manal

manal
Junior Poster
122 posts since Mar 2006
Reputation Points: 37
Solved Threads: 17
 

thanks. listen i found this code but it's in c#... i need something that is exactly like this....but in vb.net 2003......

http://www.codeproject.com/csharp/combobox.asp

please help me :) thank you for your co-operation

lukis
Newbie Poster
14 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

guys imagine i have this table

Rest_type Rest_name Tel Location
----------- ------------ --- ----------

ala carte del pinto 2345546 Dublin
pizzeria francesco's 3455667 Rome


now i have a form with a combobox (cbRests), and 2 textboxes (txtType, txtTel)

i have been able to include the Rest_name in the combobox but i need to fill in the textboxes with the relevant info...ex

when i select del pinto from the combobox, i want the textboxes to display ala carte and 2345546....how can i do that......in code please as i have no idea on how to do that.... thank you very much...your help is very much needed here

lukis
Newbie Poster
14 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You