?
Solved

Using Two List View

Posted on 2005-04-06
9
Medium Priority
?
197 Views
Last Modified: 2010-04-16
hi every body
i want to use two list views in my form
select an item from one list view and against that information from data base come in secong list view
like i have two list views one have students ids
when i click on any one of  the ids ,,,the list of courses for that particular id come in other list view
plz help me as soon as possible
i m waiting for reply
n code ll highly appriciated
thanks
peace Aamir
0
Comment
  • 6
  • 3
9 Comments
 
LVL 1

Expert Comment

by:sourabhkothari
ID: 13720610
set the multiselect property of listview with student id's to false.
now put a event handler of list view item activate.
and get the value of item selected by listview.selecteditems method.
now you know which item was clicked so populate the other list view with corresponding courses.

Skot
0
 
LVL 2

Author Comment

by:Mohammad Aamir Qureshi
ID: 13724453
hi
i understand ur answer but plz can u give me code for this which ll b more precise 4 me
thanks
peace Aamir
0
 
LVL 2

Author Comment

by:Mohammad Aamir Qureshi
ID: 13724740
plz plz plz help me i m waiting
i m using this code but it also gives errors
try
{
object[] studentID =new object[1] ;
stlist.SelectedItems.CopyTo(studentID,0);
OleDbCommand command = new OleDbCommand ("Select Course_Name from CourseStudent where Student_ID="+studentID[0], myConnection);
string coursename;
OleDbDataReader reader=command.ExecuteReader();
while (reader.Read())
{
coursename = reader.GetOrdinal("Course_Name").ToString();
stlist.Items.Add (coursename);
}
reader.Close();
}
catch(Exception ee)
{
MessageBox.Show(ee.Message);
}
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:sourabhkothari
ID: 13724938
can u tell what specific error is it giving.
also make sure you have set the multiselect property to false.

Skot
0
 
LVL 2

Author Comment

by:Mohammad Aamir Qureshi
ID: 13725167
multi select property is false
n if suppose i select id=46 then error is
Syntax error(missing operator) in query expression 'Student_ID=ListViewItem:{46}'.
0
 
LVL 1

Accepted Solution

by:
sourabhkothari earned 60 total points
ID: 13726859
u have to get the student id by either listviewitem.index property
or by int.parse(listviewitem.text) property
u can't just assign student id to the object listviewitem.

Skot
0
 
LVL 2

Author Comment

by:Mohammad Aamir Qureshi
ID: 13733431
hi
can u plz give me code for this bcoz my problem is not going to solve by me plz plz plz plz plz i m waiting 4 ur response
plz help me
peace Aamir
0
 
LVL 2

Author Comment

by:Mohammad Aamir Qureshi
ID: 13734053
Skot i m waiting 4 ur response plz reply me
0
 
LVL 2

Author Comment

by:Mohammad Aamir Qureshi
ID: 13760013
hello  sourabhkothari

how r u .Hummmmm you can not give me brief/ more explanation but ur suggestion was helpful

once Again thankx
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question