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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Can I Assign An HTML Tag to a Visual Basic 6 Constant? 2

Status
Not open for further replies.

MiniMe2

Programmer
May 19, 2002
15
US
I wrote the the following line of code:

Const c_Image1 = &quot;<img src=&quot; width=8 height=8 border=0>&quot;

NOTE: the &quot;;&quot; following the .gif string was placed by tek-tips message software, not by me.

When I attempted to compile the code, I received the following message:

&quot;Compiler error: Expected: end of statement&quot;

The blue highlight ends up on the word http. I imagine that the problem is the extra double quote. Is there a special character that I can use or a function that will allow to to turn this HTML tag into a constant?

I would rather not have to chop the tag up, if I can avoid it.
 
I don't know vb, but this is how I'd do it in html:

Const c_Image1 = &quot;<img src=' width=8 height=8 border=0>&quot;;

and in PHP and javascript I know you could also do this:

Const c_Image1 = &quot;<img src=\&quot; width=8 height=8 border=0>&quot;;

Rick If I have helped you just click the first link below to let me know :)
 
Im not a VB programmer, but a Delphi one, what i would do is
this: Since &quot; in the tag are screwing you first i would let
it run through a function which deletes them from the tag.

Something like:

make a while loop and let it find the positions of the &quot;
while that position is greater then zero make it delete
that position.

I'll show you the Delphi way to do it maybe it'll help:
STR = the string you delete it from (in this case the tag)
CHR = the character you deleting (in this case the char)

while Pos(CHR, STR) > 0 do
Delete(STR,Pos(CHR,STR),1);

Then you should have no probs assigning the string to the
const. Or var or whatever.

[bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
 
Thanks for the feedback!

My problem was finding VB's special character, which I was finally able to do.

Though I eventually may have to run the HTML code through a filter before processing it, I needed to process the HTML code as it stands written.

Also, I cannot change the original HTML file.

However, after some google searching I found out that in order to use a double quote in a Visual Basic 6 string, one must use add another double quote to it.

I was then left with the following solution:

Const c_strDoubleQuote = &quot;&quot;&quot;&quot;

Const c_Image1 = &quot;<img src=&quot; & c_strDoubleQuote & &quot; & c_strDoubleQuote & &quot; width=8 height=8 border=0>&quot;

NOTE: Again, the &quot;;&quot; following the .gif string was placed by tek-tip's message software, not by me.

MiniMe2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top