473,405 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Getting the value of the second column of a listview

lotus18
866 512MB
Hello World

I have this code:

Expand|Select|Wrap|Line Numbers
  1. Windows.Forms.Cursor.Current = Cursors.WaitCursor
  2.  
  3.         Call Main.SetConnection()
  4.         For i = 1 To frmSchedules.lvwSchedules.Items.Count
  5.  
  6.             Command = New OleDbCommand("Select * From Subjects Where SubjectCode " & _
  7.             "Not In ('" & frmSchedules.lvwSchedules.Items(i).SubItems(1).Text & _
  8.             "')", dbConnection)
  9.             Command.CommandType = CommandType.Text
  10.             Data = Command.ExecuteReader
  11.             lvwSubjects.Items.Clear()
  12.             While Data.Read
  13.                 Item = lvwSubjects.Items.Add(Data(0))
  14.                 Item.SubItems.Add(Data(1))
  15.             End While
  16.         Next i
  17.  
  18.         Data.Close()
  19.         Main.CloseConnection() 'Close Connection
  20.         Windows.Forms.Cursor.Current = Cursors.Default
Everytime I execute this it fails me. and it says InvalidArgument=Value of '9' is not valid for 'index'. My main purpose is to display only the subjects in a listview1 that are not present in a listview2. Waiting for your replies : )

Rey Sean
Jun 11 '08 #1
2 1637
Plater
7,872 Expert 4TB
I believe you want:
Expand|Select|Wrap|Line Numbers
  1. For i = 1 To (frmSchedules.lvwSchedules.Items.Count -1)
  2.  
Jun 11 '08 #2
lotus18
866 512MB
I believe you want:
Expand|Select|Wrap|Line Numbers
  1. For i = 1 To (frmSchedules.lvwSchedules.Items.Count -1)
  2.  
Ah I see. I had a wrong calculations LOL. Thanks Plater.

Rey Sean
Jun 12 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: rmorvay | last post by:
I have successfully integrated sorting in the listview control with the following code: Private Sub ListView_ColumnClick(ByVal sender As Object, ByVal e As...
3
by: Dave Rich | last post by:
Hi I am trying to access the listview items from a SysListView32 control in C#. I am using LVM.FINDITEM and LVFINDINFO through SendMessage to try to get the text from each column in the item (it...
5
by: objectref | last post by:
Hi to all, i populate a ListView with data from a datareader and i just want to know the column name of the cell that the user clicks on. E.x., if the user clicks on the 2nd column, 3rd row in...
1
by: Mamatha | last post by:
Hi I have one VB.NET application with the listview control.i saved the contents of one column only when i click on the save button.Now i want to save the contents of second column also,how can...
6
by: George | last post by:
Hi all, How can I get the value stored from the selected item and subitems of a listview? Thanks in advance, George
4
by: tneufeld | last post by:
I am using a ListView control to display 2 columns of data that I populate manually. I can get the data in the first column easily enough. its when i try to get the data in the second column...
5
by: John Devlon | last post by:
Hi, Does anyone know how to get a value of a second column of a selected item in Listview. I've create a listview and added this code Listview.Items.Clear() Listview.Columns.Clear()...
3
lotus18
by: lotus18 | last post by:
Hello World It's me again. LOL, I know how to get the selected item on the second column of a listview. frmCourses.lvwCourses.SelectedItem().SubItems(2) But I don't know how to do it with...
9
Catalyst159
by: Catalyst159 | last post by:
I have a form which is used to calculate residential Floor Area Ratio (FAR). The form is structured into seven parts as follows: Part A: Maximum FAR and Floor Area: Part B: Gross Floor Area of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.