Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace the chart in the array and substitute the name in textboxt multiline(Vb6)

Status
Not open for further replies.

satriano

Programmer
Joined
May 19, 2025
Messages
1
I have an array of images where I upload charts.
If I upload a chart, the title of that chart is automatically
written in a list in Multiline Text1.
My question is: If I replace a chart in an image of the array,
how can I replace the corresponding name in Text1?
In the same position.
Thanks
Here is my code that works (almost perfectly). The only problem is that it writes the name
of the replaced graph twice. How can I improve the problem?
'===================
Dim Slash As String
On Error Resume Next
If Right(App.Path, 1) <> "\" Then Slash = "\"
CommonDialog1.InitDir = App.Path & Slash & "Graphics"
CommonDialog1.FileName = App.Path & Slash & "Graphics" & "\*.*"

CommonDialog1.ShowOpen
Image1(Index).Picture = LoadPicture(CommonDialog1.FileName)
Dim a As String
a = CommonDialog1.FileTitle




Text1.Text = Text1.Text & Left$(a, Len(a) - 4) & vbCrLf ' Write graphic name in Text1 Multiline

Dim fileNames() as String
fileNames = Split(Text1.Text, vbCRLF)
Text1.Text = Replace(Text1.Text, fileNames(index), Left$(a, Len(a) - 4))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top