Changing Text in Listbox

  • Thread starter Thread starter y770
  • Start date Start date
Y

y770

I have an unbound Listbox whose source is a Value List.
I need to update a value in one of the columns in selected row based on the
value of another TextBox.
It would make sence to simply state: Me.lstBox.Column(2) = Me.txtBox
but Column property is Read-Only and you cannot assign value to it.:-(
Is there a simple way to do it other then redefine the whole RowSource?

y770
 
Look in VBA help for the AddItem and RemoveItem methods. It explains how to
do this and has some decent examples.
 
y770 said:
I have an unbound Listbox whose source is a Value List.
I need to update a value in one of the columns in selected row based on the
value of another TextBox.
It would make sence to simply state: Me.lstBox.Column(2) = Me.txtBox
but Column property is Read-Only and you cannot assign value to it.:-(
Is there a simple way to do it other then redefine the whole RowSource?


No, not that I ever heard of.
 
Klatuu said:
Look in VBA help for the AddItem and RemoveItem methods. It explains how to
do this and has some decent examples.


Sheesh, when did RemoveItem show up?

I guess it's been a loooonng time since I used a Value List
:-\
 
y770 said:
I have an unbound Listbox whose source is a Value List.
I need to update a value in one of the columns in selected row based on
the
value of another TextBox.
It would make sence to simply state: Me.lstBox.Column(2) = Me.txtBox
but Column property is Read-Only and you cannot assign value to it.:-(
Is there a simple way to do it other then redefine the whole RowSource?

y770

Another way to do it:

Dim a As Variant

a = Split(Me.lstBox.RowSource, ";")
a(2) = Me.txtBox
Me.lstBox.RowSource = Join(a, ";")
 
Back
Top