| | |
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 .net2005 30minutes 2005 2008 access account arithmetic array basic binary bing button buttons center check code combobox component connectionstring crystalreport data database databasesearch datagrid datagridview date design dissertation dissertations dissertationthesis dropdownlist excel fade file-dialog folder ftp generatetags google hardcopy image images input insert intel internet login mobile monitor ms net networking objects output passingparameters peertopeervideostreaming picturebox picturebox1 port print problem problemwithinstallation project reports" save savedialog searchbox searchvb.net select serial shutdown soap survey table tcp temperature text textbox timer toolbox trim update updown user usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf





