Jump to content
  • Advertisement
Sign in to follow this  
wilhil

vb writing a file and quotation marks

This topic is 4843 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi I have someone who wants me to make them a change password application, what I thought of was writing a customised .vb file that has scripts, and the shell to it, the command is : Set objUser = GetObject _ ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") objUser.ChangePassword "i5A2sj*!", "jl3R86df" but basically edit it along these liens Call mTxtStream.WriteLine (" Set objUser = GetObject _ Call mTxtStream.WriteLine (" ("LDAP://cn=GuidoT,ou=Worcester,dc=cp,dc=com") ") Call mTxtStream.WriteLine (" objUser.ChangePassword " "textbox1.caption" ", " "textbox2.caption"" ") only, I dont know how to do quotation marks and brackets (although not sure if they have a problem) in a data stream, I was wondering if anyone can help Thanks

Share this post


Link to post
Share on other sites
Advertisement
Quotation marks can be achieved by telling to print them in hex. If you are using VB6 then it would be..Chr(&H22)

It tells the application to write the Character for Hex value 22. Here's what you'll need:

Chr(&H22) = "
Chr(&H5B) = [
Chr(&H5D) = ]

Hope that helps!

Share this post


Link to post
Share on other sites
To escape quotation marks in VB, double them up.
So, "This is a ""string"" in VB." is the VB equivalent of "This is a \"string\" in C."
If it's more about the way the file is being recorded, when you "write" data to a file it sticks it in a sort of CSV format, so strings get quotation marks around them. If you want to just directly write a string to a file without VB modifying it, use "print" instead.

Share this post


Link to post
Share on other sites
I hate all the "" " "" or whatever it is, I have enough of it when I do asp, and it confuses the hell out of me when I need to go over my code and check for stuff,

but I do like the hex method, do I do the following?

Call mTxtStream.WriteLine (" (" Chr(&H22) "LDAP://cn=GuidoT,ou=Worcester,dc=cp,dc=com" Chr(&H22)" ")

to make

("LDAP://cn=GuidoT,ou=Worcester,dc=cp,dc=com")

Thansk

Share this post


Link to post
Share on other sites
Chr() just returns the character for the code you put in (so Chr(13) & Chr(10) is the same as vbCrLf).
I assume you had & signs in your post, but they got eaten.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!