Click here to Skip to main content
15,911,139 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
Private Sub ListView1_Click()
If ListView1.ListItems.Count > 0 Then
Text1.Text = ListView1.ListItems(ListView1.SelectedItem.Index).Text
Text2.Text = ListView1.ListItems(ListView1.SelectedItem.Index).ListSubItems(1).Text

Sql = "SELECT A.AID,A.UNIT,B.LOC_NAME,C.SNAME FROM ASSET A,LOCATION B,SUPPLIER C WHERE "
Sql = Sql + "A.LOC_ID=B.LOC_ID AND A.SUP_ID=C.SUP_ID AND AID=" & Text1.Text
RS.Open Sql, CON, 1, 2
Combo2.Text = RS!UNIT
COM1
    Combo1.Text = RS!LOC_NAME                //combo with style - 2
COM5
    Combo5.Text = RS!SNAME                  //combo with style - 2
End If
End Sub
Private Sub COM5()
    If Combo5.ListIndex = -1 Then
    For I = 0 To Combo5.ListCount - 1
    Combo5.ListIndex = I
    Next
    End If
End Sub

Private Sub COM1()
    If Combo1.ListIndex = -1 Then
    For I = 0 To Combo1.ListCount - 1
    Combo1.ListIndex = I
    Next
    End If
End Sub

When I click on ListView1 error occurs:
'text' property is read only.....

plz help me
Posted
Updated 7-Mar-13 4:30am
v2

1 solution

While ComboBox.Style is equal 2 - DropDownList, Text property is read only. If you want to change value of ComboBox, you need to set ItemIndex property to one of list element ItemData(index).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900