• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 147
  • Last Modified:

Object Title is a Long

I have a Long variable called ImageName that can go anywhere from 0 to infinity. It works with the following code that is designated to make a new image:

Set myImage = FormName.Controls.Add("VB.image", ImageName)

There is one problem though; ImageName must be a string, therefore an error is present if it is a Long. So basically, my question is, how can I do it so ImageName is a long?
0
blizzdek
Asked:
blizzdek
  • 2
  • 2
1 Solution
 
fantasy1001Commented:
Have you try str(ImageName)?
0
 
blizzdekAuthor Commented:
yes I have, but when I write str(imagename) it returns the number but with a space at the beginning, which then makes it an invalid image control name. How can I fix that little space?
0
 
pg_indiaCommented:
do trim(str(imagename))
0
 
pg_indiaCommented:
or u can use trim(cstr(imagename))
0
 
fantasy1001Commented:
if there is only leading space at the beginning, then

ltrim(str(imagename))

Cheers
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now