Product : Engine, Version : 4.1.6.1028, ArticleID : 41023385

HowTo : Change an attribute ValueString.

Article41023385
TypeHowTo
ProductEngine
Version4.1.6.1028
Date Added1/14/2004
Submitted byTakis
Keywords

Subject

Change an attribute ValueString.

Summary

How to change an attribute ValueString.

Solution

See the Visual Basic 6 code sample below:

Private Sub VDPro1_MouseDown(Button As Integer, Shift As Integer, x As Double, y As Double)

Dim ent As vdFigure
Dim ins As vdInsert
Dim attr As vdAttrib
Dim count As Integer
Dim i As Integer
Dim result As VbMsgBoxResult
    
    Set ent = VDPro1.ActiveDocument.GetEntityFromPOINT(VDPro1.CursorPos)
    If Not ent Is Nothing Then
        If ent.Type = "VDINSERT" Then
            Set ins = ent
            count = ins.count
            For i = 0 To count - 1
                result = MsgBox("Do you want to change the attribute with tag:" + ins.Attribute(i).TagString + "?", vbYesNo, "Attribute")
                If result = vbYes Then
                    ins.Attribute(i).ValueString = "NEW VALUE"
                End If
            Next i
            ins.Invalidate
        End If
        MsgBox "You did not select an attribute!"
    Else
        MsgBox "You did not select an entity!"
    End If
    VDPro1.Redraw
End Sub