| | |
combobox and textbox
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2008
Posts: 29
Reputation:
Solved Threads: 1
use data binding.
There are many guides or examples on this, but i googled and this is the first result i got.
http://www.startvbdotnet.com/ado/Simplebinding.aspx
There are many guides or examples on this, but i googled and this is the first result i got.
http://www.startvbdotnet.com/ado/Simplebinding.aspx
first is what field is your primary key? is it the dept_code or dept_name?
Now, what you want is a little bit complicated WHEN your primary is the dept_code.
Why? because if your primary is dept_code then it is very possible that there will be the same department name but have different code. right? so ergo, if you are going to select a department name the department code to be return will be the first department code saved in the database, thus you are not sure that the department code you are looking is the correct one.
regards.
•
•
•
•
When i select a particular dept_name from the combobox i should get the corrosponding dept_code in the textbox.
Why? because if your primary is dept_code then it is very possible that there will be the same department name but have different code. right? so ergo, if you are going to select a department name the department code to be return will be the first department code saved in the database, thus you are not sure that the department code you are looking is the correct one.
regards.
A conclusion is the place where you got tired of thinking. http://www.martin2k.co.uk/forums/index.php?showforum=4
http://www.a1vbcode.com/a1vbcode/vbforums/Forum3-1.aspx
http://www.developerfusion.co.uk/for...orum&ForumID=4
•
•
Join Date: Feb 2009
Posts: 3
Reputation:
Solved Threads: 1
Hello,
I am Not as good as all of you but i tried with this, and i am agree with jireh.
And After I try i am at following :-
First Declare Con as Connection
I am Not as good as all of you but i tried with this, and i am agree with jireh.
And After I try i am at following :-
First Declare Con as Connection
VB.NET Syntax (Toggle Plain Text)
Private sub Combobox1_selectedindexchanged(byval sender As System.object, ByVal e as system.eventargs) Handles Combobox1.Selectedindexchanged '(declare con as connection) Dim Da as New OledbDataAdapter Dim Ds As New Dataset Dim Dt As DataTable Try Da=New OledbDataAdapter("Select * from Tablename where DeptName="& Combobox1.SelectedItem & "",Con) Da.fill(Ds, "TableName") Dt = Ds.Tables("TableName") Catch ex As Exception Messagebox.show(ex.Message) End Try Textbox1.Text = Dt.Rows.Item(0).Item(0) End sub
![]() |
Similar Threads
- how to get binded combobox selected item? (C++)
- how can i display data in textbox from choosen dropdown menu? (VB.NET)
- How to change a textbox to a dropdown with Drop Down Menu (HTML and CSS)
- retreive data in textbox (C#)
- VB.NET ComboBox & Statusbar HELP! (VB.NET)
- Combobox Arrays? (Visual Basic 4 / 5 / 6)
- Using combobox selection to search dataset (VB.NET)
- ComboBox bind data problem (VB.NET)
- text box value in asp (ASP)
- Making T.Greer's JavaScript-synthesised combobox dynamic (JavaScript / DHTML / AJAX)
Other Threads in the VB.NET Forum
- Previous Thread: Help in Crystal report
- Next Thread: E-mail a PDF file from MS Access 2003
| Thread Tools | Search this Thread |
.net .net2008 2008 access add advanced application array assignment basic beginner box browser button buttons center click client code combo cpu cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic eclipse editvb.net employees excel exists filter forms html images isnumericfuntioncall listview map mobile module msaccess mssqlbackend mysql net number open pan panel pdf picturebox picturebox2 port position print printing printpreview read record regex reuse right-to-left save search serial settings shutdown socket sorting sqldatbase sqlserver storedprocedure temp textbox timer timespan transparency txttoxmlconverter usercontol vb vb.net vba vbnet vista visual visualbasic visualbasic.net visualstudio.net web winforms winsock wpf wrapingcode xml year





