Hi Cor,
thx for the link, it was very useful. im still however
having problems. im trying to insert a value obtained
from a combobox into the subitem of the listview but i
keep getting the following error....
Overload resolution failed because no accessible 'Add'
can be called with these arguments:
'Public Overloads Function Add(text As String) As
System.Windows.Forms.ListViewItem.ListViewSubItem' : Value
of type 'System.Data.SqlTypes.SqlString' cannot be
converted to 'String'.
'Public Overloads Function Add(item As
System.Windows.Forms.ListViewItem.ListViewSubItem) As
System.Windows.Forms.ListViewItem.ListViewSubItem' : Value
of type 'System.Data.SqlTypes.SqlString' cannot be
converted
to 'System.Windows.Forms.ListViewItem.ListViewSubItem '.
I have no idea what im doin wrong!! the code i have has
been pasted below. Can u spot my Mistake??.....
Private Sub btnSelRoom_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnSelRoom.Click
Dim ChosenDate As Date
ChosenDate = dtpRoomDate.Value.ToShortDateString
Dim ChosenRoom As SqlString
ChosenRoom = CBoxRoomNames.SelectedItem
Dim ChosenLayout As SqlString
ChosenLayout = CBoxLayout.SelectedItem
Dim ChosenSession As SqlString
ChosenSession = CBoxSession.SelectedItem
Dim ChosenGuestNo As String
ChosenGuestNo = txtNoOfGuests.Text
Dim Item1 As New ListViewItem(ChosenDate, 0)
Item1.SubItems.Add(ChosenRoom)
Item1.SubItems.Add("ChosenLayout")
LViewSelRooms.Items.AddRange(New ListViewItem() {Item1})
Many thx
-----Original Message-----
Hi Eva,
To add items to a listview you have to add "listviewitem"
Have a look at this page,
http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/cpref/html/frlrfsystemwindowsformslistviewitemclasstopi
c.asp
If you still have problems after that message again OK?
Cor
I wanted to know how i can enter values into a specific
column of a listview. I have tried the following code
but this seems to enter all my values into the first
column!!!
Can anyone please help me out on this??
hers my code so far.....
Private Sub btnSelRoom_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnSelRoom.Click
Dim ChosenDate As Date
ChosenDate = dtpRoomDate.Value.ToShortDateString
Dim ChosenRoom As SqlString
ChosenRoom = CBoxRoomNames.SelectedItem
Dim ChosenLayout As SqlString
ChosenLayout = CBoxLayout.SelectedItem
Dim ChosenSession As SqlString
ChosenSession = CBoxSession.SelectedItem
Dim ChosenGuestNo As String
ChosenGuestNo = txtNoOfGuests.Text
Dim ChosenMeal As String
Dim FullDescription As String
FullDescription = String.Format("{0}, {1}, {2}, {3},
{4}", ChosenDate, ChosenRoom, ChosenLayout, ChosenSession,
ChosenGuestNo)
LViewSelRooms.Items.Add(FullDescription)
End Sub
Many thx.
And Merry xmas to all :o)
.