Lester Ryan Arnaiz
Lester Ryan Arnaiz

Reputation: 11

Strip double quotes from a string

Here's my problem :

"p1".FillColor = Color.Gray

The goal is :

p1.FillColor = Color.Gray

Upvotes: 0

Views: 134

Answers (1)

Alex K.
Alex K.

Reputation: 175748

You cannot magically convert the string literal "p1" in to the identifier p1, instead use the string name to locate the control:

VB6: Me.Controls("p1").FillColor = whatever

VB.Net:

CType(Me.Controls.Find("p1", True)(0), XXX).FillColor = Color.Gray

where XXX is the type name of the control

Upvotes: 1

Related Questions