Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
lstItems = ListView1.Items.Add(nam1)
lstItems.SubItems.Add(Mid(mem1, 1, 4))
lstItems.SubItems.Add(nuscheck)
lstItems.SubItems.Add("£" & tot1)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
mystore = ListView1.Text
TextBox1.Text = lstItems.Text
End Sub
End Class
Hi i need to get this working asap:?/
i am using a listview and on form2 when data is added it will add itself to form3, but the button on form3 to go back will go back, but when i add new data it will not add to listview with current data:/ how can i get around htis...
hi i have 2 forms in which the data needs to be transferred from, on form 2 i would like to carry over the name and total aswell as membership number to the listview situated on form3
membership number = mem1
name = nam1
and total = tot1
well when the proceed button is pressed on form2 it will copy the values (nam1, tot1 and mem1) to form3 and place it in its listview (on form3) and then i also want a back button to form2 so i can reenter other peoples name and when proceed is clicked again it will add it to the listview under the previous entry :/
Can't you just refer to the other form like in VB6? Read the listview items out of one form (form2.lvMembership. etc) to set the items in the listview on form 3.
Dim item As New ListViewItem(form2.listview1.item(1))
ListView1.Items.Add(item)
I'm new to vb.net, more used to listviews in VB6, so that may be off some, but that's the idea. If form3 needed a value in a textbox on form2, say, you could do: strMyString = form2.txtMyTxtbox.text
Well, check out the actual code for adding items and subitems to a listview in vb.net, I may have been off there, as I wrote above. You also need to have the listview set to the proper style for columns to work.
Maybe you can't reference another form in .net, but that seems a backward step.
Maybe you could declare the listviews in a code module (class module in .net?) using code, then reference them from anywhere in the project, i.e. a global declaration.
This would be a trivial problem in VB6, and maybe is in .Net, but don't know enough .Net to tell you for sure.
Originally posted by salvelinus Can't you just refer to the other form like in VB6? Read the listview items out of one form (form2.lvMembership. etc) to set the items in the listview on form 3.
VB6 is nothing like VB.Net, it has the same syntax (names of commands) but other then that its very different.
I VB6 you can call another form simply by saying
Form3.WhatEver
In VB.Net you have to ask the specific instance. You must have a reference to this instance. Ive included a small example of this, with 2 different ways of doing it.
Id suggest looking up how an OOP language works if you are new to .Net, its one of the most important aspects, there are many example about.
Last edited by Grimfort; Jan 21st, 2004 at 12:31 PM.