i am using dotnet 2003.i am doing my project in vb.net windows application.i have two form in my project.first form is datagrid .In second form label,textboxes and combobox are avilable to save the entering values in datagrid of first form through this 2nd form.my problem is,i want to search a value using combobox.
for example,
in first form,
there are 4 columns named as name,age,rollno,address in datagrid.
values are ramu for namecolumn,24 for age column,42 for rollno column,cbe for address column.now values in datagrid like below
id name age rollno address
1 ramu 24 42 cbe
2 somu 23 32 che
here id is primary key.
in 2nd form,there are 4 label,4 textbox and 1 combobox.textbox arenamed as nametextbox,agetextbox,rollnotextbox,addresstextbo x and 1 combobox named as searchcombobox.
now values of name(ramu,somu) are stored in combobox.
my problem is,
in second form,
if i click the value ramu in combobox means,want to display the values of ramu in textboxes.(ie..want to display automatically ramu in nametextbox,24 in age textbox,42 in rollnotextbox,cbe in address textbox)
during runtime in vb.net windows application.so how i automatically display the values of row in each textbox by clicking the values in combobox.plz help me.
1 6723
i am using dotnet 2003.i am doing my project in vb.net windows application.i have two form in my project.first form is datagrid .In second form label,textboxes and combobox are avilable to save the entering values in datagrid of first form through this 2nd form.my problem is,i want to search a value using combobox.
for example,
in first form,
there are 4 columns named as name,age,rollno,address in datagrid.
values are ramu for namecolumn,24 for age column,42 for rollno column,cbe for address column.now values in datagrid like below
id name age rollno address
1 ramu 24 42 cbe
2 somu 23 32 che
here id is primary key.
in 2nd form,there are 4 label,4 textbox and 1 combobox.textbox arenamed as nametextbox,agetextbox,rollnotextbox,addresstextbo x and 1 combobox named as searchcombobox.
now values of name(ramu,somu) are stored in combobox.
my problem is,
in second form,
if i click the value ramu in combobox means,want to display the values of ramu in textboxes.(ie..want to display automatically ramu in nametextbox,24 in age textbox,42 in rollnotextbox,cbe in address textbox)
during runtime in vb.net windows application.so how i automatically display the values of row in each textbox by clicking the values in combobox.plz help me.
I think you have these records in database.........
then bind the combobox with name and id.
populate a Dataset(say dsStudent ) with this sql query..... SELECT id,name FROM mytable
then set the ValueMember and DisplayMember property of combobox like this -
-
searchcombobox.DataSource=dsStudent
-
' Suppose dsStudent is the DataSet name
-
searchcombobox.ValueMember ="id"
-
searchcombobox.DisplayMember ="name"
-
In the SelectedIndexChanged of the combobox retrieve the id and execute a sql statement like this... -
-
dim student_id as string
-
dim sql as string
-
student_id = CType(searchcombobox.SelectedItem, DataRowView).Row("id")
-
sql ="SELECT name,age,rollno,address FROM mytable WHERE
-
id='" & student_id & "'"
-
with the above sql populate a dataset(say dsSingleRecord)
Now bind the dataset(dsSingleRecord) with 4 textboxes like - nametextbox.Text=dsSingleRecord.Tables(0).Rows(0).Item(0)
-
agetextbox.Text=dsSingleRecord.Tables(0).Rows(0).Item(1)
-
rollnotextbox.Text=dsSingleRecord.Tables(0).Rows(0).Item(2)
-
addresstextbox .Text=dsSingleRecord.Tables(0).Rows(0).Item(3)
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: amoona |
last post by:
Hi…
I’m doing a search page form my work for their library. Since
this is the first time I work with ASP I’m facing some problems.
Each library item has different search data, I was able to...
|
by: Christopher Koh |
last post by:
I will make a form which will search the database (just like google
interface) that will look/match for the exact name in the records of a
given fieldname. Any suggestions on how to make the code?
|
by: Lauren Wilson |
last post by:
A2K
I have a combo box that shows the content of a last name field from a
table. I use it to locate records in the table form.
I can open the form and locate several names quickly by placing...
|
by: Steph |
last post by:
Hi.
I'm very new to MS Access and have been presented with an Access database
of contacts by my employer.
I am trying to redesign the main form of the database so that a button
entitled...
|
by: dskillingstad |
last post by:
Would appreciate any help I could get
I have an unbound search form with various text boxes on it for
searching my database. I would like to have a combo box on the search
form where the source...
|
by: DavidB |
last post by:
OK folks I am having a serious brain fart here and can't get the code
to do what I really want done. I have a form that has a multi-table
query as its data source. The data is dsplayed on the...
|
by: imwhiteandnerdy |
last post by:
i'm kinda a newbie I would appreciate some help
Basically i'm setting up a search page using multiple options from a combo box
Combo Box(2 options)
First Name
Last Name
text box to the...
|
by: mforema |
last post by:
Hi Everyone,
I want to search records by typing in multiple keywords. I currently have a search form. It has a combo box, text box, Search command button, and a subform. The combo box lists the...
|
by: suek |
last post by:
I have a table with over 4000 records to search upon, and the users
don't like a combo box.
So what I have been trying to do for the last twelve hours is do some
code to get a text box to search. ...
|
by: hottoku |
last post by:
Hi All,
I'm having quite a bit of trouble designing a search tool to work with
my database. I have found lots of examples from Microsoft Templates
to Allen Browne's sample search form. The...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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,...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |