combobox question

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2006
Posts: 14
Reputation: lukis is an unknown quantity at this point 
Solved Threads: 0
lukis lukis is offline Offline
Newbie Poster

combobox question

 
0
  #1
Oct 25th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 122
Reputation: manal is an unknown quantity at this point 
Solved Threads: 17
manal's Avatar
manal manal is offline Offline
Junior Poster

Re: combobox question

 
0
  #2
Oct 26th, 2006
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
  1. Me.DataSet11.Clear()
  2. Me.OleDbDataAdapter1.Fill(DataSet11)

now the list of comboBox has the names of ur customers

i hope this help
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 14
Reputation: lukis is an unknown quantity at this point 
Solved Threads: 0
lukis lukis is offline Offline
Newbie Poster

Re: combobox question

 
0
  #3
Oct 26th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 122
Reputation: manal is an unknown quantity at this point 
Solved Threads: 17
manal's Avatar
manal manal is offline Offline
Junior Poster

Re: combobox question

 
0
  #4
Oct 26th, 2006
hi:cheesy:
i used dataset and dataadptor for display the other data in text box
the sql query will be like this

  1. select email , name
  2. from customer
  3. where id =?

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

  1. 'here you select the row from table with id that user choose from comboBox
  2. OleDbDataAdapter2.SelectCommand.Parameters("ID").Value = Me.ComboBox1.Text
  3.  
  4. Me.DataSet21.Clear()
  5. Me.OleDbDataAdapter2.Fill(DataSet21)
  6.  
  7. TextBox1.Text = DataSet21.Tables("customer").Rows(0).Item("email")
  8.  
  9. TextBox2.Text = DataSet21.Tables("customer").Rows(0).Item("name")


i hope this what u want

manal
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 14
Reputation: lukis is an unknown quantity at this point 
Solved Threads: 0
lukis lukis is offline Offline
Newbie Poster

Re: combobox question

 
0
  #5
Oct 28th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 14
Reputation: lukis is an unknown quantity at this point 
Solved Threads: 0
lukis lukis is offline Offline
Newbie Poster

Re: combobox question

 
0
  #6
Nov 3rd, 2006
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC