how to bring the items at list view to the another form

Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Mar 2008
Posts: 24
Reputation: _::suhanna::_ is an unknown quantity at this point 
Solved Threads: 0
_::suhanna::_ _::suhanna::_ is offline Offline
Newbie Poster

how to bring the items at list view to the another form

 
0
  #1
Mar 5th, 2008
would you all help me?

how do i do, when i double click at item using list view then bring and display the items at textbox and option button at the another form??please help me...im in urgent...thank you so much..
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 65
Reputation: SolTec is an unknown quantity at this point 
Solved Threads: 4
SolTec SolTec is offline Offline
Junior Poster in Training

Re: how to bring the items at list view to the another form

 
0
  #2
Mar 5th, 2008
Originally Posted by _::suhanna::_ View Post
would you all help me?

how do i do, when i double click at item using list view then bring and display the items at textbox and option button at the another form??please help me...im in urgent...thank you so much..
When you double-click on the listview box, you are actually clicking on index numbered item in that listbox. If you use the Index.text and the Forms.frmName.frmFieldName.Text, you should be able to copy any index from the listbox to the other form's textbox or field.
The journey of a thousand miles, begins with the first step!
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: how to bring the items at list view to the another form

 
0
  #3
Mar 6th, 2008
make a public shared variable to accomodate your item and you can call it in other form.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 24
Reputation: _::suhanna::_ is an unknown quantity at this point 
Solved Threads: 0
_::suhanna::_ _::suhanna::_ is offline Offline
Newbie Poster

Re: how to bring the items at list view to the another form

 
0
  #4
Mar 6th, 2008
Originally Posted by SolTec View Post
When you double-click on the listview box, you are actually clicking on index numbered item in that listbox. If you use the Index.text and the Forms.frmName.frmFieldName.Text, you should be able to copy any index from the listbox to the other form's textbox or field.
Hi....SolTec

Thanks yeah for your reply
but if u dont mind...can u guide me with some sample code
actually i dont know about vb.net much...

Thanks
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 24
Reputation: _::suhanna::_ is an unknown quantity at this point 
Solved Threads: 0
_::suhanna::_ _::suhanna::_ is offline Offline
Newbie Poster

Re: how to bring the items at list view to the another form

 
0
  #5
Mar 6th, 2008
Originally Posted by Jx_Man View Post
make a public shared variable to accomodate your item and you can call it in other form.
Hi....Jx_Man

Thanks yeah for your reply
but if u dont mind...can u guide me with some sample code
actually i dont know about vb.net much...

Thanks
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 65
Reputation: SolTec is an unknown quantity at this point 
Solved Threads: 4
SolTec SolTec is offline Offline
Junior Poster in Training

Re: how to bring the items at list view to the another form

 
0
  #6
Mar 6th, 2008
Originally Posted by _::suhanna::_ View Post
Hi....SolTec

Thanks yeah for your reply
but if u dont mind...can u guide me with some sample code
actually i dont know about vb.net much...

Thanks
Create a project with Form1 and Form2, place a button on Form1 along with a listbox and label

In Form1 load event place this:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
lstListBox.Items.Add("Item1")
lstListBox.Items.Add("Item2")
lstListBox.Items.Add("Item3")

End Sub

To add the item from Form1 to Form2, ass this code in the listbox double-click event

Private Sub lstListBox_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lstListBox.MouseDoubleClick
If lstListBox.SelectedIndex = -1 Then
MsgBox("Please select an item in the list and double-left click it with your mouse")
Else
Form2.frm2Label.Text = lstListBox.Text
Form2.frm2ListBox.Text = Form2.frm2ListBox.Items.Add(lstListBox.Text)
End If

End Sub

And, finally to see your selected item added to your listbox and label on Form2, press the button.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim frm As Form
frm = Form2
frm.Show()
End Sub
The journey of a thousand miles, begins with the first step!
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: how to bring the items at list view to the another form

 
2
  #7
Mar 6th, 2008
Hi....Jx_Man

Thanks yeah for your reply
but if u dont mind...can u guide me with some sample code
actually i dont know about vb.net much...

Thanks
this code in form 1
  1. Public Shared temp As String
  2. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  3. Dim i As Integer
  4. For i = 1 To 10
  5. ListView1.Items.Add(i)
  6. Next i
  7. End Sub
  8.  
  9. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  10. Dim frm2 As New Form2
  11. frm2.Show()
  12. End Sub
  13.  
  14. Private Sub ListView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.Click
  15. temp = ListView1.SelectedItems(0).Text
  16. Label1.Text = ListView1.SelectedItems(0).Text
  17. End Sub

this code in form 2 :
  1. Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2. TextBox1.Text = Form1.temp
  3. End Sub

This an attachment of my code

ListView - Daniweb.zip

Ok. Hope this helps..
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 24
Reputation: _::suhanna::_ is an unknown quantity at this point 
Solved Threads: 0
_::suhanna::_ _::suhanna::_ is offline Offline
Newbie Poster

Re: how to bring the items at list view to the another form

 
0
  #8
Mar 9th, 2008
hi...

thanxx yeah soltex...
thank you so much..
for helping me...

i really appreciate thats...

thanks again...
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 24
Reputation: _::suhanna::_ is an unknown quantity at this point 
Solved Threads: 0
_::suhanna::_ _::suhanna::_ is offline Offline
Newbie Poster

thanks..

 
0
  #9
Mar 9th, 2008
hi...

thanxx yeah Jx_Man.
thank you so much..
for helping me...

i really appreciate thats...

thanks again...
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 24
Reputation: _::suhanna::_ is an unknown quantity at this point 
Solved Threads: 0
_::suhanna::_ _::suhanna::_ is offline Offline
Newbie Poster

Re: how to bring the items at list view to the another form

 
0
  #10
Mar 10th, 2008
why every time, when i running the project then this error will come out InvalidArgument=Value of '1' is not valid for 'index'.
Parameter name: index

if i put SelectedItems(0).Text can run..
but if i put SelectedItems(1).Text then cannot run..

why?
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC