|
I've got a string variable that goes through heavy string manipulation that may or may not leave the string with a 'carriage return - line feed' at the end.
It is declared like this:
Dim buf as String<br />
Dim filenum as Integer
Now i'm trying to output this string into a file and this is JUST ONE of the ways i've tried:
filenum = FreeFile<br />
Open "newfile.txt" For Output As filenum<br />
Print #filenum, buf<br />
Close filenum
Now here's my problem: No matter how i try this, after opening the file in an external editor I see that a 'carriage return - line feed' has been added to the end. I can't seem to avoid this and it's DRIVING ME CRAZY!
When 'buf' has a final character of '.', then when I open the file in my editor and press <Ctrl>+<End>, I expect the cursor to fall to the right of the '.' not on the blank line below. And before you ask, the editor I'm using doesn't do anything extra like ensuring a blank last line (like the VB environment).
I've tried various combinations of: opening the file in binary or text mode, opening for input or random, using the 'Print' or 'Put' function.
Can anybody tell me how to output a string to a file WITHOUT adding a blank last line?
thanks,
nebbish
Smart, Sexy, Sane. Pick two.
|
|
|
|
|
try with :
write #filenum, buf
Pablo75
|
|
|
|
|
Well thanks for the idea Pablo75, but the 'Write' statement added a double quote at the beginning and again at the end of the file. Essentially the whole file was enclosed in one set of double-quotes.
And by the way, for anybody else whose reading this thread as well, I've had success when opening the file in binary mode and using the 'Put' function EXCEPT when I am replacing an existing (text) file with a string that is shorter. In those cases, opening the file in binary does not reset the length of the file, so the file ends up being my new string followed by the old contents of the file that existed beyond the length of the new string.
Can I open an existing file in binary and somehow reset the file length? discarding the old contents entirely?
thanks,
nebbish
Smart, Sexy, Sane. Pick two.
|
|
|
|
|
Can you have public properties in a web service? I need to set some variables used inside the web service.
|
|
|
|
|
I want to write a function in VB dll which is to be exported in VC++. I created the activex dll and wrote a simple function which displays dialog box in module file. Pl tell me the syntax to export this function.
|
|
|
|
|
VB dlls don't have "exports" in the standard dll sense. Instead you use CoCreateInstance to instantiate them and use the ActiveX mechanism with them.
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
Anyone know of a tool that will track down memory leaks in vb6.0?
I don't do VB much - but i have some code to maintain that is leaking quite heavily...I know the principles, release my objects, etc..but I don't have the time to go over other people's code and find them...Thanks!!!
Marcus Spitzmiller
"Why must life be so hard? Why must I fail at every attempt at masonry?" - Homer
|
|
|
|
|
Numega Bounds Checker:
http://www.compuware.com/products/devpartner/bounds.htm[^]
This product integrates right into VStudio and works very well.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
Thanks!
Marcus Spitzmiller
"Why must life be so hard? Why must I fail at every attempt at masonry?" - Homer
|
|
|
|
|
I'm working with text files right now and I'm confused about a certain method. In many code examples, I see that after people put a string in a text box, they usually follow it up with a statment like "textbox1.select(1,0)"
What does this do? Why is it important? What do the parameters mean?
The VB help didn't really help me out that much.
Thanks for all your help!
The Jazz Master 6000
DJ Badknees
Parma Grind Crew - www.geocities.com/parmagrindcrew
|
|
|
|
|
This allows you to select text inside the textbox. By Select I mean highlighted as you do with a mouse by clicking and dragging.
'Fill the text box with some chars
textbox1.Text = "ABCDEFGHIJ"
'This line will highlight the first 3 characters
'in the text box
textbox1.Select(0,3)
It is located in the help here:
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwindowsformstextboxbaseclassselecttopic1.asp?frame=true[^]
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
How do you get the .PasswordChar of a textbox to be the solid black cirlce like in XP windows?
|
|
|
|
|
See this[^] article.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Thanks for the info. It would be nice if you could access the same controls M$ uses. The XP Style password box displays a ballon tip when you turn CAPS Lock on and things like that.
|
|
|
|
|
I add an application to the …\Windows\CurrentVersion\Run\ folder in the registry during an install, and would like to start the application immediately.
The first solution would be to start the application manually from within a Visual Basic Script Custom Action, and the second solution would be to force a system reboot.
Either would be acceptable.
But I can’t seem to figure out how to set the “REBOOT” property to “Force” or to run an application in my Visual Basic script.
Any help would be good.
Thank you in advance.
|
|
|
|
|
To launch an external app try WshShell.Run or WshShell.Exec and supply it with the exact same command line that you put into the Run key.
You can find more info on the WshShell.Run command here:
http:
RageInTheMachine9532
|
|
|
|
|
I would like to know How to add MouseEventHandler for any Object which is NOT a Sub-Class of Control or Component.
|
|
|
|
|
I am not sure how to do this if you are referring to something drawn onto the form via GDI.
Vasant Salian wrote:
BETTER TO BURN OUT THAN TO FADE AWAY
I KNOW this was said by a musician... maybe the Who, maybe the Roling Stones... but it was also at the botton of Kurt Cobains suiside note.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
I wrote 2 different projects 1 and 2 at different time. Now I want to have project 1 calling project 2. How can I do that? Any hint will be appreciated
|
|
|
|
|
A few more details please?
is one project a component and another an exe maybe?
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
The 2 projects are independent.
|
|
|
|
|
Ok.... and by 'calling' what exactly do you mean?
- Do you want the first app to start the second app? You can simply shell out and start the second app fronm the first.
- Do you want to pass data back and fourth between them? Theer are several ays to do this... remoting, sockets, shared memory, shared files, etc...
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
yeah, i want the first to start the second. How can I do that?
|
|
|
|
|
Check out the help under System.Diagnostics.Process
Here is some code from my head....
Dim myproc As System.Diagnostics.Process
myproc = New System.Diagnostics.Process
myproc.EnableRaisingEvents = False
myproc.Start("notepad.exe")
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
Ok, how would I ping a certain IPAddress or Server Name and also determine if a certain Port is Listening / Open?
|
|
|
|