Problem with Listview
-
hi all thanks for previous reply. I have another qurey.I serched lot for this ,but did't get proper solution. Actully in my application m using vb.net2003 and access.On one form I have used tabcontrol with 2 tabpages.On 1st tabpage there is list view.I wt i want is ,when i click on any item the text of that item should display on textbox of another tabpages.To get text value of item i wrote several code like [code] Dim item As ListViewItem Dim column As Integer MessageBox.Show(item.SubItems(0).Text) or MsgBox(LstRecord.SelectedItems(1).Text) or MsgBox(LstRecord.SelectedItems(1).SubItems(2).Text) or l1.Text = LstRecord.SelectedItems(3).Text.ToString or MsgBox(e.Item.ToString) [/code] it fails every time.Plz help me.
poonam
-
hi all thanks for previous reply. I have another qurey.I serched lot for this ,but did't get proper solution. Actully in my application m using vb.net2003 and access.On one form I have used tabcontrol with 2 tabpages.On 1st tabpage there is list view.I wt i want is ,when i click on any item the text of that item should display on textbox of another tabpages.To get text value of item i wrote several code like [code] Dim item As ListViewItem Dim column As Integer MessageBox.Show(item.SubItems(0).Text) or MsgBox(LstRecord.SelectedItems(1).Text) or MsgBox(LstRecord.SelectedItems(1).SubItems(2).Text) or l1.Text = LstRecord.SelectedItems(3).Text.ToString or MsgBox(e.Item.ToString) [/code] it fails every time.Plz help me.
poonam
What error do you get? The following could be issues with your code:
poonams wrote:
MessageBox.Show(item.SubItems(0).Text)
item is not instantiated
poonams wrote:
MsgBox(LstRecord.SelectedItems(1).Text) or MsgBox(LstRecord.SelectedItems(1).SubItems(2).Text) or l1.Text = LstRecord.SelectedItems(3).Text.ToString
Most likely the maximum array subscript of SelectedItems is less than 1, ie., you have only selected 1 item from the list.