Oops, sorry about that. Are you looking for the index number of the text in
the list or are you looking for a numerical value in column 2 that
correspinds to the text in column 1?
"clara" wrote:
> Hi IT_roofer,
>
> Thank you for your answer. you misunderstood my question. My question is
> like the following:
>
> if a combo box has two columns, one is for text(display) and the other one
> is for value, when we click it , it will display a list of text , when we
> refer to it, it will give use the value behide. if we do not click it first,
> instead we assign it one of its text list, is it possible to get the
> corresponding value?
>
> Clara
>
>
>
> --
> thank you so much for your help
>
>
> "IT_roofer" wrote:
>
> > Use the object.AddItem and object.List properties [object.list(row, column)]
> >
> > With ComboBox1 'Rename ComboBox1 to the name of your control
> > .Additem "Your Text here"
> > .List(0, 1) = "1" 'Or any other value you assign
> > .Additem "Text line two"
> > .List(1, 1) = "2"
> > .Additem "Text line three"
> > .List(2, 1) = "3"
> > End With
> >
> > 'If you don't use the 'With' statement then it would be more typing.
> > 'Like so:
> >
> > ComboBox1.Additem "Your Text here"
> > ComboBox1.List(0, 1) = "1" 'Or any other value you assign
> > ComboBox1.Additem "Text line two"
> > ComboBox1.List(1, 1) = "2"
> > ComboBox1.Additem "Text line three"
> > ComboBox1.List(2, 1) = "3"
> >
> > 'For more information, look in the Help guide for AddItem and List
> > 'Hope this helps
> >
> >
> > "clara" wrote:
> >
> > > Hi all,
> > >
> > > My dropdown combo has two columns, one is for text and one is for value.
> > > When coding, is it possible to assign a text to it while the corresponding
> > > value is also assigned to it?
> > >
> > > Clara
> > > --
> > > thank you so much for your help
|