Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Pretty Printing While Writing XML DOMDocument


I use a MSXML Parser 4.0 ---- XMLDomDocument to create a new XML file.

The elements written in the file opens fine in Iexplorer, but as unformatted text while opening it in Notepad.

Is there any method to write the element line BY line...?

Thanx in Advance
Prasanna




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Pretty Printing
I have a database that has the first two columns and the first row under freeze pane. I'd like to create a sub that prints the data base...but I want it to fit on one landscape oriented page. I have several data-bases like this and they all range from 100 columns & 100 rows to approx. 10 columns and 10 rows. I'd like the print sub to print just the most recently filled in columns (they will be filled in in order from 0 to 100) I don't care if the rows run over onto another page. At the end of the 100 columns i have 5 columns that are formulas. I would like the print sub to print the first two columns, the most recent columns that can fit on a page (lets say ten) and the 5 formulated columns in that order. I would also like this to be non-destructive, i.e after its done the document is put back in order. Thanks! I hope that wasn't to garbled for anyone to understand...feel free to ask for clarification

Pretty Printing
I religiously indent everything....drives my boss crazy the amount of time I spend prettying up everything.

When I cut and paste to this message, tho, it all gets thrown out!

How do I keep the indentation?


DerFarm

Pretty Printing VB Code
I am wondering any tools or software which are available freely for printing VB code. For example in Unix we can use nenscript or enscript for pretty printing C or C++ code. If I directly print VB code from Microsoft VB editor, will it print comments,procedure names, etc with special fonts ?

"Pretty Printing Code"
Hey all....

my associates and I are getting ready to completely overhaul a project and are looking for a nice way to print out our VB code in "COLOR". We would like a PRETTY hard copy to put on our table and keep track of changes and such. We are looking for something that will print out the code similar to the way it shows in VB using "BLUE" for keywords and GREEN for remarks etc.

Any IDEAS?

Thanks...

XML & DOMDocument
Hi,
Let's assume I have this XML file:

<MyDoc>
<Document>
TextA
</Document>

<Document>
TextB
</Document>
</MyDoc>

I'd like to read out TextA, TextB into a string variable. Does somebody have some sample code to do it with DOM?

George

XML DOMDocument
Can someone tell me how to update or replace a part of an XML document Node. Everything I try I get an error.
Here is a sample of my class. I am trying to get this done in the UpdateDocument sub. I am new to the DOM Document.

Thanks.
Aston


Option Explicit

'Local variables
Private m_sDocumentname As String
Private XMLDOMDocument As DOMDocument30

----------------------------------------------------------------------------------------
Private Sub Class_Initialize()
Set XMLDOMDocument = New DOMDocument30
m_sDocumentname = App.EXEName & ".xml"
End Sub
----------------------------------------------------------------------------------------
Private Sub Class_Terminate()
Set XMLDOMDocument = Nothing
End Sub
----------------------------------------------------------------------------------------

Public Function CreateDocument(sDocumentText As String) As Boolean
'Create XML Document for use
Dim fp As Long
On Error GoTo ehandle
fp = FreeFile
Open m_sDocumentname For Output As #fp
Print #fp, sDocumentText
Close fp
XMLDOMDocument.Load m_sDocumentname
CreateDocument = True
Exit Function
ehandle:
CreateDocument = False
Err.Clear
End Function
----------------------------------------------------------------------------------------

Public Sub UpdateDocument(lNodeIndex As Long, vNode As IXMLDOMNode)

Debug.Print XMLDOMDocument.xml

Set XMLDOMDocument.childNodes(5).childNodes(lNodeIndexIndex) = vNode

Debug.Print XMLDOMDocument.xml

End Sub
----------------------------------------------------------------------------------------

Writing And Printing From A File
I would like to generate a HTML file based on data I retrieve from the database. I want to be able to write the file, save the file, and print the file automatically with no user intervention. Can anyone give me a clue as to how to write the HTML file and then automatically print it?

Many thanks for any suggestions!
Greg

Msxml 6.0 Domdocument 20,40,60 ???
I am working with the latest msxml SDK in vb6

and I am wondering why is there like 5 different variable types for the DOM, HTTPREQUEST, etc...


domDocument
domDocument26
domDocument30
domDocument40
domDocument60

and which one should I use?

MSXML.DomDocument Q
I'm using MSXML.DomDocument to check some RSS feeds.
I've noticed that it doesn't seem to update as often as it should.

Could it sometimes be reading from a cached file?
If so, is there a way to force it to always download a fresh copy of the file?

MSXML2.DOMDocument
Hi,
    I am trying to connect to an internet site that will return me an XML string for any valid request that is being send. Then i am trying to load the XML into the XMLDomDocument using the LoadXML function provided. The string is not getting loaded into the object.
    I tried to see whether there is an error with the XML string that is being send across by trying to view the same in Internet Explorer and that did not give me an error.

Code:
    
    Const INTERNET_OPEN_TYPE_PRECONFIG = 0
    Const INTERNET_FLAG_EXISITING_CONNECT = &H20000000
  
Private Declare Function InternetOpenUrl Lib "wininet.dll" Alias "InternetOpenUrlA" (ByVal hInternetSession As Long, ByVal
lpszUrl As String, ByVal lpszHeaders As String, ByVal dwHeadersLength As Long, ByVal dwFlags As Long, ByVal dwContext As Long) As Long

Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long

Private Declare Function InternetReadFile Lib "wininet.dll" (ByVal hFile As Long, ByVal sBuffer As String, ByVal lNumBytesToRead As Long, lNumberOfBytesRead As Long) As Integer

Private Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer
  
Private Function GoWinInet(ByVal sURL) As String
  
    Dim sBuffer As String * 4096
    Dim sReturn As String
    Dim lNumBytes As Long

    Dim lSession As Long
    Dim lFile As Long
    Dim bReadOK As Boolean
  
DoEvents
  
    lSession = InternetOpen("Microsoft Internet Explorer", INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0)
  
DoEvents
  
    lFile = InternetOpenUrl(lSession, sURL, vbNullString, 0, INTERNET_FLAG_EXISITING_CONNECT, 0)
  
DoEvents
  
If lFile Then
    Do
        DoEvents
        bReadOK = InternetReadFile(lFile, sBuffer, Len(sBuffer), lNumBytes)
    
        If lNumBytes Then
            sReturn = sReturn & Left$(sBuffer, lNumBytes)
        End If
  
    Loop While bReadOK And lNumBytes > 0
        InternetCloseHandle (lFile)
        GoWinInet = sReturn
    Else
        'Right Now doing nothing
End If
  
DoEvents
End Function

Private Sub Form_Load()
    Dim oDom As MSXML2.DOMDocument
    Dim oDomParseError As MSXML2.IXMLDOMParseError
    Dim strErrText As String
    Dim retStr As String
    
    Set oDom = New MSXML2.DOMDocument
    Set oDomParseError = oDom.parseError
    
    
    retStr = GoWinInet("someurl")
    MsgBox retStr
    If oDom.loadXML(Trim(retStr)) Then
         DisplayNode oDom.childNodes, 0
    Else
        
        With oDomParseError
            strErrText = "Your XML Document failed to load" & _
            "due the following error." & vbCrLf & _
            "Error #: " & .errorCode & ": " & oDomParseError.reason & _
            "Line #: " & .Line & vbCrLf & _
            "Line Position: " & .linepos & vbCrLf & _
            "Position In File: " & .filepos & vbCrLf & _
            "Source Text: " & .srcText & vbCrLf & _
            "Document URL: " & .url
        End With
        
        MsgBox strErrText, vbExclamation

    End If
    
End Sub

Public Sub DisplayNode(ByRef Nodes As MSXML2.IXMLDOMNodeList, ByVal Indent As Integer)

   Dim xNode As MSXML.IXMLDOMNode
   Indent = Indent + 2

   For Each xNode In Nodes
      If xNode.nodeType = NODE_TEXT Then
         Debug.Print Space$(Indent) & xNode.parentNode.nodeName & _
            ":" & xNode.nodeValue
      End If

      If xNode.hasChildNodes Then
         DisplayNode xNode.childNodes, Indent
      End If
   Next xNode
End Sub    


This is the XML String retrieved ....I am removing the content inside <storyurl></storyurl> for security reasons. Hope some of the guru's out here can help me with this.

Code:

<!DOCTYPE cXmlHeadlineResults SYSTEM >
<cXmlHeadlineResults SearchName="Search Results" StartDate="9/13/2004" EndDate="9/20/2004" TermsAndConditions="© 2004 Dialog, a Thomson business. All rights reserved.">
<Headline>
    <StoryId>200409201178.8_3c9b00000035974a</StoryId>
    <StoryUrl></StoryUrl>
    <HeadlineText>Iran assails ban on uranium program</HeadlineText>
    <BriefText>Iran on Sunday denounced as "illegal" demands from the U.N. atomic watchdog agency that it freeze all work on uranium enrichment, a technology that can be used for nuclear weapons, and ...</BriefText>
    <ProviderId>1178.8</ProviderId>
    <ProviderName>Contra Costa Times</ProviderName>
    <ItemTime>09/20/2004 05:30:51 AM EDT</ItemTime>
    <FeedTime>09/20/2004 05:30:51 AM EDT</FeedTime>
</Headline>
<Headline>
    <StoryId>200409201178.8_6bf70000004b10ba</StoryId>
    <StoryUrl> </StoryUrl>
    <HeadlineText>PEOPLE: Britney, baby, one more time ... singer marries beau Federline</HeadlineText>
    <BriefText>Britney Spears got married for the second time in nine months -- this time to dancer Kevin Federline in a surprise ceremony in Studio City, "Access Hollywood" reported Sunday. Brit's record label confirmed it: "She did marry him yesterday," Jive Records spokeswoman Sonia Muckle said Sunday.</BriefText>
    <ProviderId>1178.8</ProviderId>
    <ProviderName>Contra Costa Times</ProviderName>
    <ItemTime>09/20/2004 05:30:19 AM EDT</ItemTime>
    <FeedTime>09/20/2004 05:30:19 AM EDT</FeedTime>
</Headline>
<Headline>
    <StoryId>200409201178.8_3a270000005cd5a9</StoryId>
    <StoryUrl> </StoryUrl>
    <HeadlineText>Hollywood lawyer Mitchelson, pioneer of palimony, dies at 76</HeadlineText>
    <BriefText>Divorce lawyer Marvin M. Mitchelson, who pioneered the legal revolution known as "palimony" and represented scores of Hollywood clients in high-profile, big-money marital disputes, has died.</BriefText>
    <ProviderId>1178.8</ProviderId>
    <ProviderName>Contra Costa Times</ProviderName>
    <ItemTime>09/20/2004 05:30:18 AM EDT</ItemTime>
    <FeedTime>09/20/2004 05:30:18 AM EDT</FeedTime>
</Headline>
<Headline>
    <StoryId>200409201178.8_3a7e00000042c014</StoryId>
    <StoryUrl> </StoryUrl>
    <HeadlineText>Israeli helicopter attack kills Hamas leader in Gaza</HeadlineText>
    <BriefText>An Israeli helicopter fired a missile at a car in Gaza City late Sunday, residents said, killing a senior Hamas militant leader, the latest Israeli attack in the territory it plans to leave next year. Witnesses said parts of a dismembered body were pulled from the wreckage.</BriefText>
    <ProviderId>1178.8</ProviderId>
    <ProviderName>Contra Costa Times</ProviderName>
    <ItemTime>09/20/2004 05:30:18 AM EDT</ItemTime>
    <FeedTime>09/20/2004 05:30:18 AM EDT</FeedTime>
</Headline>
<Headline>
    <StoryId>20040920290.2_de5d0015ba04dbbb</StoryId>
    <StoryUrl> </StoryUrl>
    <HeadlineText>AmericanWest Bancorporation Appoints New President and Chief Executive Officer</HeadlineText>
    <BriefText>SPOKANE, Wash.----Sept. 20, 2004--AmericanWest Bancorporation announced today the appointment of Robert M. Daugherty as President and Chief Executive Officer of AmericanWest Bancorporation and its subsidiary AmericanWest Bank, effective September 20, 2004. Mr.</BriefText>
    <ProviderId>290.2</ProviderId>
    <ProviderName>Business Wire</ProviderName>
    <ItemTime>09/20/2004 05:30:05 AM EDT</ItemTime>
    <FeedTime>09/20/2004 05:30:05 AM EDT</FeedTime>
</Headline>
<Headline>
    <StoryId>200409201178.8_092f0000005bc880</StoryId>
    <StoryUrl> </StoryUrl>
    <HeadlineText>Europe finishes off rout</HeadlineText>
    <BriefText>The Ryder Cup won, Sergio Garcia and Lee Westwood raced to their boisterous fans and unfurled the European Union flag, the new symbol of dominance in these matches. They came to Oakland Hills as underdogs.</BriefText>
    <ProviderId>1178.8</ProviderId>
    <ProviderName>Contra Costa Times</ProviderName>
    <ItemTime>09/20/2004 05:29:48 AM EDT</ItemTime>
    <FeedTime>09/20/2004 05:29:48 AM EDT</FeedTime>
</Headline>
<Headline>
    <StoryId>200409201178.8_09e1000000796c07</StoryId>
    <StoryUrl> </StoryUrl>
    <HeadlineText>Ryder Cup cards</HeadlineText>
    <BriefText>Sunday At Oakland Hills Country Club Bloomfield Township, Mich. Yardage: 7,077; Par: 70 EUROPE 181/2, UNITED STATES 91/2 Singles Europe 71/2, United States 41/2 Par 453-444-443-445-344-434 Paul Casey, Europe 554-453-453-444-344-4xx Tiger Woods, United States 454-443-453-443-344-4xx United States, 3 and ...</BriefText>
    <ProviderId>1178.8</ProviderId>
    <ProviderName>Contra Costa Times</ProviderName>
    <ItemTime>09/20/2004 05:29:48 AM EDT</ItemTime>
    <FeedTime>09/20/2004 05:29:48 AM EDT</FeedTime>
</Headline>
<Headline>
    <StoryId>200409201178.8_09170000006c28a8</StoryId>
    <StoryUrl> </StoryUrl>
    <HeadlineText>Bryant's European imitation</HeadlineText>
    <BriefText>Golf roundup Bart Bryant's 0-for-186 streak is over. Bryant closed out the Texas Open with a 3-under-par 67 at La Cantera Golf Club in San Antonio on Sunday to claim his first PGA Tour victory by three strokes over Patrick Sheehan. Pleasanton's Todd Fischer birdied the last three holes to finish in a tie for third with second-round ...</BriefText>
    <ProviderId>1178.8</ProviderId>
    <ProviderName>Contra Costa Times</ProviderName>
    <ItemTime>09/20/2004 05:29:46 AM EDT</ItemTime>
    <FeedTime>09/20/2004 05:29:46 AM EDT</FeedTime>
</Headline>
<Paging>
    <TotalResults>254566</TotalResults>
    <TotalPages>n/a</TotalPages>
    <PrevPage>n/a</PrevPage>
    <CurrentPage>n/a</CurrentPage>
    <NextPage>15-next</NextPage>
</Paging></cXmlHeadlineResults>







Edited by - magicwanda on 9/20/2004 10:26:39 AM

Creating XML Using DomDocument
Hi all,

How can I create the "<?xml version="1.0"?>" tag using the DomDocument object? Look forward to any advice or example. Thanks.

Leslie

Writing PRN Files / Printing To File
Hi guys,

I am trying to print some data into a .prn file, just setting my printer setup do port "FILE:" etc...

Until now i was having no problem with that, just, that I can't pass the File Path parameter.

I would like to "Printer.Print" some data, and it needs to be saved as a .prn file on a server folder ez: G:Fax2006-05-06-S0001.prn"

Is there anyway to automatize the proccess, so the user don't need to select the folder / file, and my app print it directly to a FilePath that I am gonna set ?


Thanx for any help.

PS:
I'm using Visual Basic 6.0...
(In Word/Excel VBA I have a macro to do that, but i can't bring it to vb6)

Acrobat PDF Files Writing To And Printing
I am designing a program where I would like to put an image in a PDF file then from a text box on my form add that text below the image in the file then save it and print it. How would i go about doing this? Any help would be appreciated. Thank you,

Check Printing, Scanning And Writing
how to check printing, scanning and writing job in vb

DomDocument XML Query Not Working
Hi guys! This forum has dug me out of many a hole in the past, so I hope someone can spot the error here. I am trying to return xml from a web query, into a DOM Document to parse into Excel. I have created a simple test web page which writes the contents of a .NET dataset to the HTTP response stream, and am now trying to load this into Excel.

The query returns the xml as expected when viewed using a browser, but my VBA method is not getting anything back from the HTTP request.

This is my code:


Code:
Dim xmlHttp As New MSXML2.ServerXMLHTTP
Dim xmlErr As IXMLDOMParseError
Dim xmlDoc As DOMDocument
Dim lsError As String
Dim strRequest As String

On Error GoTo Hell

Set GetCustomerList = Nothing

'call function to generate query string array
'AssembleQuerystrings

'generate query string
strRequest = "http://localhost/XmlTest/query.aspx"

'set http query
Set xmlHttp = New MSXML2.ServerXMLHTTP
If Trim(strRequest) = "" Then
Exit Function
End If

'send query
xmlHttp.Open "GET", Trim(strRequest), False
xmlHttp.send

'nothing returning here!!!
Set xmlDoc = xmlHttp.responseXML

If xmlDoc.parseError.reason <> "" Then
Debug.Print xmlDoc.parseError.reason
Exit Function
End If

If (xmlDoc Is Nothing) Then
lsText = "No XML data returned (Invalid url or website unavailable)"
Debug.Print "No XML data returned (Invalid url or website unavailable)"
Exit Function
End If
Can anyone spot why I am getting nothing back? Am I missing something obvious? Thanks for your help!

Adam

DOMDocument - Change NodeName
hi!

does anybody know, how i can change the nodename of a node in a xmlfile?

i parse the file with DOMDocument (1.0 i think) and want to rename some nodes.

the only solution i found was deleting the node an replacing it with a new one, but how would i handle the child nodes?

or is there a better solution?

---
please excuse my english

Maximum DOMDocument Size
Using the MSXML4.0 library and VB6.0, I'm trying to parse a very large XML document (i.e. 5+ Mb) using DOM. Unfortunately, the statement:

xDoc.loadXML(strXML)

causes the program to die a horrible death. Any ideas why this is happening and if there is anyway DOM can be used on very large documents? Any idea what the limit for document sizes in DOM is?

MSXML.DOMDocument.load
Is MSXML.DOMDocument.load supposed to be asynchronous? Because it seems like it is, but it would be better for my app if it could be set to synchrounous, so I don't have to loop and doevents:


VB Code:
Set xml = New MSXML.DOMDocument        If xml.Load(URL) Then     Else        MsgBox "Failure to Load XML DOC.", vbInformation, "Error."        Exit Function    End If        'wait for data to load    dTemp = Now    Do While DateAdd("s", 3, dTemp) > Now        DoEvents    Loop        'Debug.Print xml.xml        'get the query node    Set xQuery = xml.getElementsByTagName("query").Item(0)...


Otherwise I get an error at that last line of code when the code runs, but not if I step thru line-by-line.

Thanks.

Problem With Msxml2.DomDocument Loadxml
Hi,

I have a code where it creates an xml file and sends it to a webservice for sending fax.

The code works perfectly when the agent name in the xml does not have '&' but when the agent name has '&' the loadxml fails. The code is as below.


Code:
Public Function CheckFaxStatus(FaxID As String, ID As String)
Dim str As String
Dim Msg As String

str = "<?xml version='1.0'?>"
str = str & "<FAXMessagesStatus>"
str = str & "<FAXMessage id='" & ID & "' FaxID='" & FaxID & "'>"
str = str & "<login servername='" & FaxServer & "' userid='CATS1' password='' />"
str = str & "</FAXMessage>"
str = str & "</FAXMessagesStatus>"
m_sXML2 = str

Dim xmldoc As New msxml2.DOMDocument

xmldoc.async = False
xmldoc.LoadXml m_sXML2
Dim xmlhttp As New msxml2.xmlhttp

xmlhttp.Open "POST", FaxCmd, False
xmlhttp.send xmldoc.xml


Dim xmlDoc1 As msxml2.DOMDocument
Set xmlDoc1 = xmlhttp.responseXML

Dim xmlNodes As msxml2.IXMLDOMNodeList
Dim xmlNode As msxml2.IXMLDOMElement
Set xmlNodes = xmlDoc1.selectNodes("//FAXMessagesStatusResponse/FAXMessage")
For Each xmlNode In xmlNodes
Msg = xmlNode.getAttribute("Status")
Next

CheckFaxStatus = Msg

End Function


xmlhttp.send xmldoc.xml statement returns blank when the agent name has '&'. Is this an issue with the load xml or is there any solution for this?

Problem Accessing MSXML.DOMDocument
Hi,
I have a problem in reading XML file in VB exe when its executed by
.NET dll in ASP.NET page

here is the flow of accessing XML file in my system

ASP.NET page -->.NET component --> VB Exe (VB exe reading XML file using MSXML.DOMDocument)

My ASP.NET page is accessing a method in .NET dll that .NET dll is calling VB exe by using System.Diagnostics.ProcessStartInfo class.
Error is occurred when creating instance of MSXML.DOMDocument object in VB exe.

In VB exe if I tried to use late binding and early binding , but the following errors are occurred.

error message when use late bind

ActiveX component can't create object

error message when use early bind

-2147023888 Automation error
An attempt was made to reference a token that does not exist.


There is no problem in Windows 2000 server with .NET Frame work 1.0, every thing is working fine.
We are facing the above problem when moved to Windows 2003 server with .NET Frame work 1.1

I have tried the following to solve , but no use..

1. re-registering the msxml.dll
2. using late bind method in vb exe
3. using msxml2.dll,msxml3.dll and msxml4.dll
4. using .NET dll compiled in .NET Frame work 1.1 (initially it was developed with .NET Frame work 1.0)


How to solve this problem? Anyone can help me to resolve?

Thanks in advance,
Sugu

The Load Method On DOMDocument Is Failing...
the Load method on DOMDocuments is failing.
It won't open semi-large text files (1MB)

Any ideas? (The 'It is false' msgbox comes up when using big files)


Code:
' -- code

Dim xmlDoc As New DOMDocument
Dim root As IXMLDOMElement, item As IXMLDOMElement, detail As IXMLDOMElement
Dim itemList As IXMLDOMNodeList
Dim counter As Integer, totalItems As Integer
Dim strDisplay As String, success As Boolean
Dim finalString As String
Dim theId As String
Dim theText As String

' Allow the document to complete loading
xmlDoc.async = False
success = xmlDoc.Load("C:Templ2.txt")

If success = True Then
Set root = xmlDoc.documentElement

Set itemList = root.selectNodes("//i")

For counter = 0 To itemList.length - 1
For Each item In itemList.item(counter).childNodes
If item.nodeName = "id" Then
itemID(counter) = item.Text
Else
itemInfo(counter) = item.Text
End If
Next item
totalItems = totalItems + 1
Next counter

' Tidy up
Set itemList = Nothing
Set root = Nothing
Else
MsgBox ("it was false")
End If

' -- end code



Thanks for any help
-Brandon

Preserving Entities In MSXML2.DOMDocument
Hi

My VB program accesses a XML document that has general entity references (like etc....) and populates the appropriate fields in the Access Database.

fRAGMENT OF MY CODE...
---------------------------------------------------------
Dim objXMLDOM As New MSXML2.DOMDocument
objXMLDOM.Load(filePath)
---------------------------------------------------------

The problem is that, the DEFAULT implementation of the parser EXPANDS the entity references, which is what I DO NOT want.

Is there any way to tell the parser NOT to expand entities?

Any help is grately appreciated!

Thanks a lot.
-Srivalli.

Unicode Problem Msxml3 DOMDocument
HI I am reading an UTF-8 encoded xml in VB6 file using DOM object having an special char in it, it reads the char as a question mark when I see the ascii char of it that is also as same for the question mark which is 63 but when I try to write this in new file it gives me error , how is it possible that if it has changed the ascii of this to 63 again it is detecting it as unicode later. Can you please help me out of this.

Writing Into Text File Without Printing The Blank Line At Teh End?
Hi,

I am opening a text file in vb for output and using write command to input data into that. But eveytime I get a blank line at the end of the text file .How can I get rid of that?

I need to merge all my text files finally into one and due to this problem the final merged fiel is showing blank line after the end of each individual text file.

Can neone get me rid of the blank line printed at end of each text file???

I have tried using semicolon ; at the end of write command but this leads to putting a comma (,) at the end of the file which i dont want ( though in such a case blank line at the end of file is not printed)

Thanx in advance!!!

Object Variable Not Set Error While Loading Xml In Domdocument
Dim strRelsAttrXML As String
Dim xdcAttrDoc As New MSXML2.DOMDocument

strRelsAttrXML = "<SText>bit.test_report_&_msg_in</SText>"
xdcAttrDoc.loadXML (strRelsAttrXML)
x = xdcAttrDoc.childNodes(0).Text
MsgBox x


Hi

Above code is not working as there is & in node text .
Help neeed. Urgent...

Thanks in advance

Memory Leak DOMDocument? String Manipulation?
Without going into huge details, I have a process does the following:

Dim jLoad as MSXML2.DOMDocument
..
1. Set jLoad = New MSXML2.DOMDocument
2. Open a text file
3. Read through text file until EOF, parsing strings and create the jLoad XML file along the way.
4. Use SQLXMLBulkLoad to load the jLoad XML file into SQL server.

Repeating steps 1 - 4 for a set of text files. The program actually does this for several sets of text files.

There's a lot of string manipulation going on where strings are passed ByVal as often as possible to functions in several classes. There are also other ADO reads and updates to SQL server along the way. And let's not forget about the SQLXMLBulkload.

After processing X number of files or sets of files, and I have not analyzed the CPU usage that closely to see exactly where/when it's happening, the machine runs low on virtual memory. You can tell because it's sluggish and when I don't get impatient and kill the process, I get the "you're running low on VM" msgbox.

There is a version of this process which processes a set of XML files rather than text files. In that version, step 3 above recursively loops through every node in a sometimes deeply nested XML tree. It seems that when those files are processed, the VM problem rears its ugly head sooner.

If anyone has any ideas how to troubleshoot this or tips on good practices when passing strings or better ways to pass strings, or tips on avoiding memory problems when updating/accessing SQL server with ADO and the SQLXMLBulkload.

Tough question, not a lot of info, I know.

Question On Writing Code For Printing Out Device Or Drive Name Of File?
Does anyone know how to write a VB program that will print out the drive or device name of a file, given the full path name? Assuming the device name is preceded by a colon and may be more than one character long.

DOMDocument - Search For A Specific Node Based On Attribute
Hi all,

I have and application which synchronize offline content with online content. I use Xml file to check which files to download.
To do this, I compare a local update file with a distant update file. I need to compare nodes based on an attribute.

Here is my Xml structure :

<?xml version="1.0"?>
<synchrocp>
<file id="1">
<filename>file1.pdf</filename>
<validdate>17/06/2005 11:01:18</validdate>
<lastupdate>17/06/2005 11:01:18</lastupdate>
</file>
<file id="2">
<filename>file2.pdf</filename>
<validdate>17/06/2005 11:01:18</validdate>
<lastupdate>17/06/2005 11:01:18</lastupdate>
</file>
</synchrocp>

Is there any way to go directly to a specific node using the <file> "id" attribute? (Like the selectSingleNode method)
Any Method in the DOMDocument Object to do that?

Thanks,

S.

VB.Net Xml.XmlDocument Equivalence For MSXML2.DOMDocument.ParseError.ErrorCode
In VB6, using DOMDocument40, there is parseError.errorCode, I want to use VB.Net's System.Xml.XmlDocument, what is the equivalence "parseError.errorCode" for Xml.XmlDocument?

Here are the snippets of the VB6 codes using parseError.ErrorCode.


Code:
Private oXMLobject As New DOMDocument
Set oXMLobject = New MSXML2.DOMDocument40

If oXMLobject.loadXML(gsINIXML) Then
If oXMLobject.parseError.errorCode <> 0 Then
....
End If
End If


Please advice!!! Thanks....

Writing To A "Sequential Access File" && Printing A Report
Can someone please take a look at my code and get me back on track here is what I'm trying to accomplish.

I want an application that will allow the user to enter the inventory number, quantity, and price of each item in inventory. The application should allow the user to record this information in a sequential access file named la3.dat

In addition, the application should allow the user to print a report showing the inventory number, quantity, and price of each inventory item, as well as the average price.

Inventory NumberQuantityItem Price
ABC12 10010.50
XYZ35 50 15.99
KLK25 15020.00

Here is what I have thus far for the printing the report:

VB Code:
Private Sub cmdPrint_Click()    Dim strIN As String, intQty As Integer, intIP As Integer, intAvg As Integer    Dim strFont As String, sngSize As Single    Dim strPS1 As String * 5, strPS2 As String * 3, strPS3 As String * 5                strFont = Printer.Font          'save current printer settings    sngSize = Printer.FontSize    Printer.Font = "courier new"    'change printer settings    Printer.FontSize = 10           'print title and headings    Printer.Print Tab(30); "Boggs Inc.Inventory Report"    Printer.Print    Printer.Print Tab(5); "Inventory Number"; Tab(25); "Quatity"; Tab(37); "Item Price"End Sub


Please Help

Please Help Me. Pretty New
I am working with a simple loop, simple txt file, and simple arrays. I'm having a problem though. I'm getting an error "loop without Do". Since I've never used loops before, I'm unsure what this means. I need the loop to continue it's looping until a variable is true. If you download the code, you can run the program and find out for yourself. I've also just posted the code to read, though you won't get the full understanding from it. Thanks to everyone for the awesome help thusfar!



Code:
Private Sub cmdOK_Click()
Dim strUN As String
Dim strPW As String
Dim strUser As String
Dim bfound As Boolean
strUN = "C:EZ-Accessdatapasswords.txt"
strPW = "C:EZ-Accessdatapasswords.txt"

iCount = 0 + 1
If txtPassword.Text & txtUserName.Text = "" Then
MsgBox ("Please enter your username and password before pressing accept")

Else: Open "C:EZ-Accessdatapasswords.txt" For Input As #1

Do While Not EOF(1)

Input #1, strUN, strPW
'No need for arrays

If strUN = txtUserName.Text Then
'Your searching the text file for your username so compare the text file with the username field.

bfound = True
'Username found = True

If (bfound = True) And (txtPassword.Text = strPW) Then
'If it's found and the passwords match

strUser = strUN
'Take the variable from the text file and store globally.

frmStart.Show
Unload Me

istaff = 1
ivehicles = 1
ireports = 1

End If

Else

Loop
'Loop if it's not found.

End If

Close #1
'Close passwords.txt after reading


End Sub

&lt;&lt;&lt;pretty Please&gt;&gt;&gt;
HELP!

I have made a small application just for experimenting with the different data access technologies, ie The DataEnvironment, and have created a setup script for it using inno setup.

It runs on a win98 system and not on a win95 system, why is that?

On a win95 system, it gives the following error:

Run-time error '713':
Application-defined or object-defined error

I have tried everything I can think of, and added every dll that it could possibly need (I hope).

I have attached the exe and a small access database, if anyone would be so kind as to take a look at what files I may be missing in the setup, or why it is giving the error.

Thanks.

Pretty Good
it looks great i just wish the link work

Can You Make This Pretty?
I have a For loop nested inside a For loop. From the innermost loop, I want to exit the inner loop, then jump to the end of the outer loop(or to the first and increment the counter manually). I can do this with a GoTo.. but GoTo's are frowned upon and I don't like them. Is there a nice, easy way to accomplish this?

Pretty Newbie
I've developed an application using microsoft-deprecated VB6.0.

That's a simple calculator for my dear friend.

That(&HE) troubling me much.

The trouble is on compatiblitiy of OS, as far as i know.

Yep experts.I've developed it on WindowsXP version5.1.

But my trouble(FRIEND) using Vista Home premium.

Lot of incompatibleness.

I'm solving gradully on my own just surfing NET.

but this time it(surfing) not worked.

The error is
"Run-time Error '-2147217904 (80040e10)' No value given for one or more required parameters"

The product works without hesitation on my system.

but it dislike the VISTA.


My friend dislike me.

What to do???


all queries, connections are perfect as far as i know.

I thought i need to do some on my product to work with VISTA

This time i need some experts advice.

I need extreme(bug free) solution.

I'd be thank ful to all repliers.

Have a great day.

This Should Be Pretty Easy
I've been using these forums for help in my VBA class all semester, got alot of good info to alot of n00b questions.

However, I can't seem to find a solution for this particualr n00b problem I am having and I was hoping to get some help.

I have a user form that takes input from the user and spits it back into the spreadsheet which also carries out the data for four years in the future.

The problem is I would like to make a button that would show the graph I have on the second worksheet.

I tried declaring it as a chart and then print preview it but it keeps telling me "sub-script out of range" so I guess I am not declaring it right. Here is what I have right now for the button.


Code:
Dim chtGraph As Chart
Set chtGraph = Application.Workbooks("ucf.xls").Worksheets("Graph").ChartObjects(1)

chtGraph.PrintPreview

Any help would be greatly appreciated

Pretty Printer
can anyone suggest a good program that allows Vb code to be printed neatly, with some formatting. the only ones i could find only do a few pages.

any suggstions

many thanks

nige

Pretty Printout
Can you folks recommend ways to make your printouts prettier or neater in VB? Currently the way I print is by using the Printer object.

-xmen64

This Is Pretty Cool
Check this out. http://www.danasoft.com/- look at the top middle.

would it be possible to program something like that in VB? If so I think that'd be cool if one of you experts wanted to that for fun.

Pretty Program
i have a pretty intense proc that takes a bit of resources, and it happens on the form activate, causing the half on/half off type effect (like a morph between forms)... any work arounds for this?

Help... Pretty Hard =(
Hello,
i have the following problem,
i have a program to administrate some products,
these products are managed under 6 categories, and each category is saved in a private database ( so 6 databases ).. now i want it to print the contents of these databases, but in a special way :

the 6 categories are :

Nr, Merk, Omschrijving, Laatste Keuring, Volgende Keuring, Manual aanwezig

and i want em printed like this :

--------------------------------------------------------------------------

Nr Merk Omschrijving Laatste Keuring Volgende Keuring Manual

data data data data data data
data data data data data data
data data data data data data
data data data data data data
data data data data data data
data data data data data data
data data data data data data
data data data data data data
data data data data data data
data data data data data data
data data data data data data


--------------------------------------------------------------------------

so its an easy readable Table ( no real tables needed, just the looks of it )..

in short points this is what i want it to do :

1. Read the 6 database files and put em in 1 A4
2. Manage those 6 database files so that they are printed in a neat clean way
3. i dont want page numbers/Date to appear on the printed A4.


Please provide me with some information ( PREFERABLE CODE! ), to make this happen.


Thank you very much!

-XxVegoxX-


=-last minute edit-=
the tabel doesnt look properly in the typed post, so i made a screenshot of what it SHOULD look like.
see attached file!

Thank you

Problem..a Pretty Big One.
Ok. I have a text field that essentially captures one record via stored procedure and then populates a form with a module called Fillform.
How do I get this text field to not only capture one record populate the form which it does but then store the other records in a temp table in a stored procedure which can locate not only where that record is among the others but can give the user the capability via next and previous buttons to navigate through the records accordingly.

Someone Who Knows Vb 6.0 Pretty Well And Can Help Me Out Via MSN Messenger
Hey

if you're pretty good at vb and have msn messenger, i need a bit of help... so if you could add me.. pointbob@ihug.co.nz

iwould post my problems here but i would have alot of posts haha

Pretty'up Them Controls
Does anyone know of a slick way to design forms, cmd buttons, etc. so they appear different then the norm. For example, I would like to make my cmd buttons appear as metal......something like that.

Ooo.. Pretty Colours......
Is it possible to malke different rows on a DBGrid different Colours?

If anyone can answer this i may be finally able to sleep!

Pretty Buttons :P
how to create a more style full button.. you know one that has a colour and rounded edges.. stuff like that :S (and not by using pictures)

Pretty Difficult
You know how you can browse through directories with a few controls provided with vb. I want to make a "snapshot" of all the directories and files. Without all the files just the file names and locations. So I can check what programs i had when i made the snapshot in the beggining. Like could i save that to a file. Then load it back into my vb program. I know it's confusing.

Im Pretty New - So This Must Be Very Easy
i have got a menustrip and a file menu. i just need to know - how do i link the save button on the file menu to the save form ive made.

also - how do i make a save dialog bit? (i dont realy need this yet tho)

 

Pretty Programs
Does anyone have any good tips on making programs look really cool!? Maybe something like giving it a theme like in Windows XP but where it looks like that on every os...


Thanks!!

Isaiah - Microsoft Visual Basic MVP

Copyright 2005-08 www.BigResource.com, All rights reserved