By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,377 Members | 3,038 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,377 IT Pros & Developers. It's quick & easy.

Is it able to transfer the values from one lsit view to another???

100+
P: 103
HI,
1) I have a list view with column id.and another list view with column name
can i get the name on other listview,if i click the id on the listview???
and
2)
if one value say gross salary of particular employee is not saved in databse and the calculation is in another form,if i have to get the gross salary of the particular employee by clicking the id in listv view1,(above mentioned),can i get that,IF THESE CONTROLS IN ANOTHER FORN WHER NO CALCULATION IS NOT DONE???

please clarify???
THANKS IN ADVANCE...........
Jan 7 '08 #1
Share this Question
Share on Google+
12 Replies


QVeen72
Expert 100+
P: 1,445
Hi,

It is definately possible if ListViews have same "Key" ..

Regards
Veena
Jan 7 '08 #2

100+
P: 103
Hi,

It is definately possible if ListViews have same "Key" ..

Regards
Veena
code:(vb)
If ListView1.SelectedItem.Checked = True Then
rs.Open "Select all date From saldetail Where id= '" & ListView1.SelectedItem & "'", conn, adOpenStatic, adLockOptimistic
ListView2.ListItems.Clear
ListView2.Refresh
ListView2.ListItems.Add = rs!Date
ListView2.Refresh
rs.Close
Set rs = Nothing

one listview with id and other with dates...
Check this out....
i need for one id i need to get their working dates as....say
102 01/02/08
01/04/08
01/06/08
but the above code is not working????pleaSE CHECK THRU
Jan 7 '08 #3

QVeen72
Expert 100+
P: 1,445
Hi,

By looking into the Code, you are using ListView as some ListBox (Only one Column) , Its better you have 2 columns..
For Second ListView, You have to Add SubItems of ID, This can be used as Key. In first ListView also use the Same ID as Key..
So when you populate second list, It should Contain 2 Columns, ID and Date.
So when you search, you can loop throug for the matching IS's
What Code, are you using for populating the First ListView..?


Regards
Veena
Jan 7 '08 #4

debasisdas
Expert 5K+
P: 8,127
1.Populate the first list view by selecting from database.
2.on selection of the id in the 1st control. pass the id to SQL and retrive the related records.
3.polulate the 2nd listview from the resultset.
Jan 7 '08 #5

100+
P: 103
Hi,
By looking into the Code, you are using ListView as some ListBox (Only one Column) , Its better you have 2 columns..
For Second ListView, You have to Add SubItems of ID, This can be used as Key. In first ListView also use the Same ID as Key..
So when you populate second list, It should Contain 2 Columns, ID and Date.
So when you search, you can loop throug for the matching IS's
What Code, are you using for populating the First ListView..?
Regards
Veena
SELECT THE RECORDS CORRESPONDING TO THE ID,WE HAVE SELECTED????
Jan 7 '08 #6

100+
P: 103
1.Populate the first list view by selecting from database.
2.on selection of the id in the 1st control. pass the id to SQL and retrive the related records.
3.polulate the 2nd listview from the resultset.
rite now im getting only one date corresponding to it..
Jan 7 '08 #7

debasisdas
Expert 5K+
P: 8,127
rite now im getting only one date corresponding to it..
do you have multiple values in the table for the specified id ?
Jan 7 '08 #8

QVeen72
Expert 100+
P: 1,445
Hi,

Loop through the Recordset and add values to ListView2,
Check your code, you are adding only first Record..

Regards
Veena
Jan 7 '08 #9

100+
P: 103
do you have multiple values in the table for the specified id ?
same id repeated??? yes
Jan 7 '08 #10

debasisdas
Expert 5K+
P: 8,127
Please find a related discussion here.
Jan 7 '08 #11

100+
P: 103
Hi,
Loop through the Recordset and add values to ListView2,
Check your code, you are adding only first Record..
Regards
Veena
If ListView1.SelectedItem.Checked = True Then
rs.Open "Select all date From saldetail Where id= '" & ListView1.SelectedItem & "'", conn, adOpenStatic, adLockOptimistic
ListView2.ListItems.Clear
ListView2.Refresh
ListView2.ListItems.Add = rs!Date
'ListView2.Refresh
'rs.MoveNext
ListView2.Refresh
rs.Close
Set rs = Nothing

my code is valid or not?
Jan 9 '08 #12

QVeen72
Expert 100+
P: 1,445
Hi,

Change it this way..

Expand|Select|Wrap|Line Numbers
  1. If ListView1.SelectedItem.Checked = True Then
  2.     rs.Open "Select all date From saldetail Where id=  '" & ListView1.SelectedItem & "'", conn, adOpenStatic, adLockOptimistic
  3.     ListView2.ListItems.Clear
  4. If Not RS.EOF Then
  5.     Do While Not rs.EOF
  6.         ListView2.ListItems.Add = rs!Date
  7.         RS.MoveNext
  8.     Loop
  9. End If
  10. rs.Close
  11. Set rs = Nothing
  12.  
Regards
Veena
Jan 9 '08 #13

Post your reply

Sign in to post your reply or Sign up for a free account.