PC Review


Reply
Thread Tools Rate Thread

How to assign value back to a dropdown combo

 
 
=?Utf-8?B?Y2xhcmE=?=
Guest
Posts: n/a
 
      24th Jul 2007
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
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SVRfcm9vZmVy?=
Guest
Posts: n/a
 
      24th Jul 2007
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

 
Reply With Quote
 
=?Utf-8?B?Y2xhcmE=?=
Guest
Posts: n/a
 
      24th Jul 2007
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

 
Reply With Quote
 
=?Utf-8?B?SVRfcm9vZmVy?=
Guest
Posts: n/a
 
      24th Jul 2007
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dropdown combo values dependent on another combo =?Utf-8?B?Q1c=?= Microsoft Access 3 3rd Feb 2007 03:02 PM
How to assign value to a dropdown box items? Anil Gupte Microsoft VB .NET 5 8th Oct 2006 06:08 AM
How do I assign values to a property in a custom control that has a dropdown style Kay Microsoft ASP .NET 0 4th Feb 2006 11:45 AM
How do I assign values to a property of a custom control which has a dropdown style Kay Microsoft VB .NET 0 3rd Feb 2006 05:17 PM
Assign Macros to a dropdown list =?Utf-8?B?SlQ=?= Microsoft Excel Programming 6 12th Nov 2004 12:43 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:55 PM.