ListView Adding and Removing Items

ListView Adding and Removing Items

Page 1 of 1

6 Replies - 7101 Views - Last Post: 03 August 2010 - 02:19 PM Rate Topic: -----

#1 BJseal91  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 68
  • Joined: 18-April 09

ListView Adding and Removing Items

Posted 03 August 2010 - 06:02 AM

Hi there I have started a new project and needed some help on Listview1 box
so I will begin

I have a listview box with 3 collems

like this

Attached Image

And on the second Form

Attached Image

now on the second image with the radio buttions there is a button called flagged
I want to add X X in the following 2 collems when the button is pressed once and when it is pressed again it removes the xx

exaple

when button is pressed once
Question Flagged Answerd
1 X X

When button is pressed again
Question Flagged Answerd
1

so it adds and removes the X X as needed

this is the first time I have ever done anything like this

I have done a lot of stuff with listboxes and know how they work but needed the grid lines and buttons
at the top

Code so far


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListView1.Items.Add("1")
End Sub

which will add in the first collem fine but can not add to the other 2 collems any help will be geatfully appricated

Kind regards

BJseal91

Hope this made sence any questions please ask away and will will answer any questions

Is This A Good Question/Topic? 0
  • +

Replies To: ListView Adding and Removing Items

#2 motcom  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 290
  • View blog
  • Posts: 1,371
  • Joined: 16-June 08

Re: ListView Adding and Removing Items

Posted 03 August 2010 - 06:41 AM

Hi,

Are you having problems or are you telling us how to do this??? Maybe you want to add a tutorial on this one?
Was This Post Helpful? 0
  • +
  • -

#3 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1606
  • View blog
  • Posts: 5,163
  • Joined: 25-September 09

Re: ListView Adding and Removing Items

Posted 03 August 2010 - 06:46 AM

I'm confused, you answered this question with what appears to be an answer to your own question. Or am I totally misunderstanding
Was This Post Helpful? 0
  • +
  • -

#4 BJseal91  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 68
  • Joined: 18-April 09

Re: ListView Adding and Removing Items

Posted 03 August 2010 - 06:58 AM

View Postmotcom, on 03 August 2010 - 05:41 AM, said:

Hi,

Are you having problems or are you telling us how to do this??? Maybe you want to add a tutorial on this one?

Hi yes I am having Problems Adding to the other 2 collems so I can add information to the first collem
but not the second and therd

So Collem 1 Has question in it
Collem 2 Has Flagged in it
and collem 3 has Answerd in it

So what I want to to Is to be able to add and take away information from those 2 collems only

so when the button is pressed once it will add X X into collems 2 and 3 and when i click the button again it will remove xx from collems 2 and 3 so I am just left with 1

and yes dont have any idia how to add and remove to collems that was what i needed coding help with

Kind Regards

BJseal91
Was This Post Helpful? 0
  • +
  • -

#5 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1606
  • View blog
  • Posts: 5,163
  • Joined: 25-September 09

Re: ListView Adding and Removing Items

Posted 03 August 2010 - 07:03 AM

based on a selection, you can use
listview1.focusedItem.Subitems(1).Text where SubItems(1) is the 2nd column, and SubItems(2) would be the 3rd column.

FocusedItem is the row that is selected

Therefore, ListView1.FocusedItem.SubItems(1).Text = "Test" will fill in the 2nd column of the selected row with the word Test.

This post has been edited by CharlieMay: 03 August 2010 - 07:11 AM

Was This Post Helpful? 1
  • +
  • -

#6 BJseal91  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 68
  • Joined: 18-April 09

Re: ListView Adding and Removing Items

Posted 03 August 2010 - 07:10 AM

Great Thanks For Replies I will give that Ago and let you know
really appciate it

Bradley
Was This Post Helpful? 0
  • +
  • -

#7 Guest_Bjseal91*


Reputation:

Re: ListView Adding and Removing Items

Posted 03 August 2010 - 02:19 PM

Problem solved
I used
ListView1.Items(0).SubItems.Add("X")
ListView1.Items(0).SubItems.Add("X")

works a treat for fortuere refrance thanks for all replies tho
Was This Post Helpful? 0

Page 1 of 1