Results 1 to 3 of 3

Thread: [RESOLVED] Listview issues and confused newbie

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2009
    Posts
    5

    Resolved [RESOLVED] Listview issues and confused newbie

    Ok, I'm teaching myself Visual Basic and I'm building a project that I think I would enjoy working on to be able to help teach me how to code in VB, so the project I am working on is a list building application for Warhammer 40k (The table top miniatures game). Very nerdy, I know, but it makes learning a little more fun and interesting for me

    The problem I am having (And I am 100% sure I will have many more) is that I am trying to gather data on one form and then add the gathered data to a listview control on another form.

    Form 1 has the listview control
    Form 2 has the information and a button to add the info to the listview control on form one, if the user so decides to add that to the list.

    I've searched for an answer but came up very confused because it seems people add a button to form 1 in order to add the information from form 2 to the listview control? And then again I could just be reading it completely wrong and not understanding it at all.

    Hopefully what I said I am trying to do makes sense so that someone can give me an answer, I also included a screencap of what the forms in question to give you a better idea of what I am trying to do. Please don't judge the interface, it's not at all what I want it to be right now Right now I just want to build something that WORKS and then clean up the interface and make it look more like I want it.



    So yeah, basically when the user clicks add unit it adds Ghazzy to the listview control on the other form, along with the subitems (Points and quantity, if they added an ammo runt, ect)

    How exactly do I go about doing this?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Listview issues and confused newbie

    There are various ways that this could be done. The easiest way would be to declare the ListView Public or Friend, which it is by default, and then access it directly from Form2 via the Form1 default instance. That's not the way I'd do it but it's the easiest way. You access the default instance using the the class name itself, i.e. Form1. For more information, follow the last link in my signature.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2009
    Posts
    5

    Re: Listview issues and confused newbie

    God I feel so stupid now! After looking through my code again I realized that I opened the first form as a new instance. I fixed that and opened it with the default instance and it worked perfectly.

    I'm going to blame my stupidity on it being so late. But thank you very much for your help, and that article will actually be very useful too.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width