List Info

Thread: Buttons to strings




Buttons to strings
country flaguser name
United States
2008-05-12 09:00:19

Hi,

Ideally, I would like to be able to replace:
"Option1(0)";

with:
a$

where:
a$="Option1(0)"

I could then make up a$ by, for example:
a$="Option"+str(x%)+"(0)"
and generate a range of a$ values depening on x%

However, this does not work as if I use the above for a$ and say:
If a$ = True Then End

I get a type mismatch error.

Can anyone suggest a way of overcoming this such that I can make up
a string to represent "Option1(0)";, please?

Many thanks,

Peter

__._,_.___
.

__,_._,___
Re: Buttons to strings
country flaguser name
Australia
2008-05-12 22:42:33

angeladerekjenny wrote:
>
> Ideally, I would like to be able to replace:
> "Option1(0)";
>
> with:
> a$
>
> where:
> a$="Option1(0)"

This example is for command buttons, but it will work for other controls.

Dim ctl As CommandButton
Set ctl = Me.Controls("Command" & CStr(x%))(0)
ctl.Caption = "Hello world."

Adelle.

__._,_.___
.

__,_._,___
Re: Buttons to strings
country flaguser name
Canada
2008-05-12 17:04:02

I believe that's impossible in vb6, maybe a better programmer than me would
know.

On Mon, May 12, 2008 at 10:00 AM, angeladerekjenny < p_l_reed%40hotmail.com">p_l_reedhotmail.com>
wrote:

> Hi,
>
> Ideally, I would like to be able to replace:
> "Option1(0)";
>
> with:
&gt; a$
>
> where:
&gt; a$="Option1(0)&quot;
>;
> I could then make up a$ by, for example:
> a$="Option"+str(x%)+"(0)"
> and generate a range of a$ values depening on x%
>
> However, this does not work as if I use the above for a$ and say:
>; If a$ = True Then End
>
> I get a type mismatch error.
&gt;
> Can anyone suggest a way of overcoming this such that I can make up
> a string to represent "Option1(0)";, please?
>
> Many thanks,
>
> Peter
&gt;
>
>
>;
> ------------------------------------
&gt;
>
> '// =======================================================
&gt; Rules : http://ReliableAnswers.com/List/Rules.asp
> Home : http://groups.yahoo.com/group/vbHelp/
> =======================================================
&gt; Post : vbHelp%40yahoogroups.com">vbHelpyahoogroups.com
&gt; Join : vbHelp-subscribe%40yahoogroups.com">vbHelp-subscribeyahoogroups.com
> Leave : vbHelp-unsubscribe%40yahoogroups.com">vbHelp-unsubscribeyahoogroups.com
> '// =======================================================
&gt; Yahoo! Groups Links
&gt;
>
>
>;

--
Don Roberts - don%40roberts.net">donroberts.net
http://www.myspace.com/donroberts

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )