String values in the place of specifying the actual object 
Author Message
 String values in the place of specifying the actual object

How does one go about taking a string variable's value and making it act

like an object...say you have a variable that contains the string
"imgExit", but in a statement you want to add say ".visible = true" to
it and then make it execute properly?  Does it also work for arrays as
well such as the string value being "imgExit(1)"?  The code I have is as

follows (the code below does not currently work and needs some
modification...that modification I need help from the outside world on):

Dim blnLinkActivated As Boolean ' Keeps track of  wheter a link is
currently highlighted
Dim strLinkActivatedName As String ' If a link is highlighted the name
of the link goes here

Private Sub imgExit_MouseMove(Index As Integer, Button As Integer, _
Shift As Integer,X As Single, Y As Single)
    HighlightLink "imgExit(1)"
End Sub

Private Sub HighlightLink(ByVal ImageName As String) ' highlights/ _
unhighlights, and verifies wheter a link is still valid
   If blnLinkActivated = False Then
        blnLinkActivated = True
        strLinkActivatedName = ImageName
        ImageName.Visible = True
    Else
        If ((X < ImageName.Left) And (Y < ImageName.Top)) Or _
        ((X > ImageName.Left + ImageName.Width) And (Y > _
        ImageName.Top + ImageName.Height)) Then ' checks to see _
        if the mouse is currently over the highlighted link
            blnLinkActivated = False
            ImageName.Visible = False
        End If
    End If
End Sub

                  GRENDLE

                  InDoom We Trust (soon to be automated using Visual
Basic)
                  http://www.*-*-*.com/
 -------------------------------
    I'm currently in development of automating my page to a great
extent...taking my page and splitting it into two sections (an official
section and an unofficial section).  With the help from VB, people to my

page will be able to send in level reviews and see them in the
unofficial section within minutes (maybe seconds depending on the
sender's connection) rather than days for me to type up all the code.  I

can be at school (god I'm there long enough, 12 frickin' hours a day!)
and the automation will still be in place, well that is if Windows
doesn't randomly crash on my...well, nevermind).  Being 17, I take this
step toward automation very proudly...Got everything working...just need

a darn static IP  address so I can have a permanent FTP.



Sat, 15 Sep 2001 03:00:00 GMT  
 String values in the place of specifying the actual object
The short answer ( not much time left...):

Use:

    HighlightLink imgExit(1)

And:

Private Sub HighlightLink(ImageName)
...
        strLinkActivatedName = ImageName.Name
        ImageName.Visible = True

Quote:

> How does one go about taking a string variable's value and making it act

> like an object...say you have a variable that contains the string
> "imgExit", but in a statement you want to add say ".visible = true" to
> it and then make it execute properly?  Does it also work for arrays as
> well such as the string value being "imgExit(1)"?  The code I have is as

> follows (the code below does not currently work and needs some
> modification...that modification I need help from the outside world on):

> Dim blnLinkActivated As Boolean ' Keeps track of  wheter a link is
> currently highlighted
> Dim strLinkActivatedName As String ' If a link is highlighted the name
> of the link goes here

> Private Sub imgExit_MouseMove(Index As Integer, Button As Integer, _
> Shift As Integer,X As Single, Y As Single)
>     HighlightLink "imgExit(1)"
> End Sub

> Private Sub HighlightLink(ByVal ImageName As String) ' highlights/ _
> unhighlights, and verifies wheter a link is still valid
>    If blnLinkActivated = False Then
>         blnLinkActivated = True
>         strLinkActivatedName = ImageName
>         ImageName.Visible = True
>     Else
>         If ((X < ImageName.Left) And (Y < ImageName.Top)) Or _
>         ((X > ImageName.Left + ImageName.Width) And (Y > _
>         ImageName.Top + ImageName.Height)) Then ' checks to see _
>         if the mouse is currently over the highlighted link
>             blnLinkActivated = False
>             ImageName.Visible = False
>         End If
>     End If
> End Sub



Sun, 16 Sep 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Using string to specify method to call on object

2. How to get value of the object's attribute ,the object's attribute is specified by a string variable ?

3. How to get value of the object's attribute ,the object's attribute is specified by a string variable ?

4. Specifying Decimal Places

5. Specifying decimal places at run time

6. Value not actual in data grid

7. What is actual value of 0x1005

8. Reference to an object from a String value

9. Put value and string together to object name

10. String with Object.Value in it....

11. Making an OLE object into an actual file

12. Inserting HeaderFooter-objects to the actual section

 

 
Powered by phpBB® Forum Software