|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to convert code snipped from VB6 to Visual Studio 2005/VB (VB7?)I found some sample VB code which I'm trying to implement in Visual
Studio 2005. I think the code was VB6. VS05 doesn't like the syntax. I've distilled things down to the part with the error: Public Sub WontRun(ByVal v As ListView) Dim x As ListItem x = v.ListItems.Add(, , "c:\test\file.txt") End Sub Error 1 'ListItems' is not a member of 'System.Windows.Forms.ListView'. Does anybody know what the correct code would be for this under Visual Studio 2005/VB? Assuming "v" is a listview control:
Dim x as ListViewItem x = v.Items.Add(, , "c:\test\file.text") Thanks, Seth Rowe vb newbie wrote: Show quoteHide quote > I found some sample VB code which I'm trying to implement in Visual > Studio 2005. I think the code was VB6. VS05 doesn't like the syntax. > I've distilled things down to the part with the error: > > Public Sub WontRun(ByVal v As ListView) > Dim x As ListItem > x = v.ListItems.Add(, , "c:\test\file.txt") > End Sub > > > Error 1 'ListItems' is not a member of > 'System.Windows.Forms.ListView'. > > > Does anybody know what the correct code would be for this under Visual > Studio 2005/VB?
Show quote
Hide quote
On 3 Oct 2006 17:48:59 -0700, "vb newbie" <techquestions.20.technodw***@xoxy.net> The syntax for ListView in VS05 is somewhat different than in VB6.wrote: >I found some sample VB code which I'm trying to implement in Visual >Studio 2005. I think the code was VB6. VS05 doesn't like the syntax. >I've distilled things down to the part with the error: > >Public Sub WontRun(ByVal v As ListView) > Dim x As ListItem > x = v.ListItems.Add(, , "c:\test\file.txt") >End Sub > > >Error 1 'ListItems' is not a member of >'System.Windows.Forms.ListView'. > > >Does anybody know what the correct code would be for this under Visual >Studio 2005/VB? This is a very elementry question. The answer can easily be found in the Help file, with simple example. Lookup ListView Control, adding list iems, and, adding ListSubItems. Gene Have you tried the VB 6 converter in VS 2005? It handles short code
segments really well. Just don't use it for entire projects as it will make a mess of the converted code. Mike Ober. Show quoteHide quote "vb newbie" <techquestions.20.technodw***@xoxy.net> wrote in message news:1159922939.038466.259090@m73g2000cwd.googlegroups.com... > I found some sample VB code which I'm trying to implement in Visual > Studio 2005. I think the code was VB6. VS05 doesn't like the syntax. > I've distilled things down to the part with the error: > > Public Sub WontRun(ByVal v As ListView) > Dim x As ListItem > x = v.ListItems.Add(, , "c:\test\file.txt") > End Sub > > > Error 1 'ListItems' is not a member of > 'System.Windows.Forms.ListView'. > > > Does anybody know what the correct code would be for this under Visual > Studio 2005/VB? >
.NET 2 recommended books?
Sending email with attachments Data Set to Excel ? vb.net serial IO problem writing commands to command prompt in VB.NET Open folders to process files automatically Datetimepicker - just getting the data part ComboBox.Items.Clear() SelectedIndexChanged causes selectedindex to reset to -1? How hard would this be? |
|||||||||||||||||||||||