| | |
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: Jan 2008
Posts: 65
Reputation:
Solved Threads: 4
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!
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 *
So, Please do something before post your thread.
* PM Asking will be ignored *
•
•
Join Date: Mar 2008
Posts: 24
Reputation:
Solved Threads: 0
•
•
•
•
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.
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
•
•
Join Date: Jan 2008
Posts: 65
Reputation:
Solved Threads: 4
•
•
•
•
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
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!
•
•
•
•
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
vb.net Syntax (Toggle Plain Text)
Public Shared temp As String Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim i As Integer For i = 1 To 10 ListView1.Items.Add(i) Next i End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim frm2 As New Form2 frm2.Show() End Sub Private Sub ListView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.Click temp = ListView1.SelectedItems(0).Text Label1.Text = ListView1.SelectedItems(0).Text End Sub
this code in form 2 :
vb.net Syntax (Toggle Plain Text)
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load TextBox1.Text = Form1.temp 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 *
So, Please do something before post your thread.
* PM Asking will be ignored *
![]() |
Other Threads in the VB.NET Forum
- Previous Thread: Web browser with predermined par of URL
- Next Thread: How to link a button to an HTML page?
| Thread Tools | Search this Thread |
.net 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 gridview hardcopy image images input insert intel internet listview mobile monitor ms net networking objects output passingparameters peertopeervideostreaming picturebox picturebox1 plugin port print problem problemwithinstallation project remove reports" save searchbox searchvb.net select serial shutdown soap survey table tcp temperature text textbox timer toolbox trim update updown user vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf






