|
If you're talking about the ProductCode, then this is a script I use by putting a shortcut in the SendTo menu to get it. All I do is right-click the .MSI, Send To -> GetProductCode.
Dim msi,database,view1,record,productCode
Set msi = CreateObject("WindowsInstaller.Installer")
Set database = msi.OpenDatabase(WScript.Arguments(0), 1)
Set view1 = database.OpenView("SELECT `Value` FROM `Property` WHERE `Property` = 'ProductCode'")
Call view1.Execute
Set record = view1.Fetch
If record Is Nothing Then
MsgBox "Unable to find a ProductCode in the MSI database!"
WScript.Quit
End if
productCode = record.StringData(1)
Set record = view1.Fetch
If record Is Nothing Then
RecordsReturned = 1
Else
RecordsReturned = 2
End If
Set record = Nothing
view1.Close
Set view1 = Nothing
Set database = Nothing
Set msi = Nothing
If RecordsReturned = 1 Then
InputBox "The ProductCode is:", WScript.Arguments(0), productCode
Else
MsgBox "There was more than one 'ProductCode' record returned from the MSI database!!"
End If
|
|
|
|
|
I need the ability to print files out from our application. I can use the ProcessStartInfo to do this in the background with out any issue using the following code:
Dim psi As New ProcessStartInfo()
With psi
.Verb = "print"
.WindowStyle = ProcessWindowStyle.Hidden
.FileName = "C:\Quote.pdf"
.UseShellExecute = True
End With
I also need to be able to change the printer that it uses depending on the reports specified. But I need to be able to change the printer in the background without user interaction
Does anyone know how to change the printer for the print job? or am I going about this the wrong way?
Thanks
Simon
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Change the .Verb to "printto", then add the printer name, preferrably in quotes, in the Arguments property:
.Verb = "printto"
.Arguments = """printerName"""
|
|
|
|
|
Thanks Dave
I tried what you suggested but PDF files can't be printed to a remote printer using processstartinfo as printto isn't a verb that is setup by default when installing the Adobe reader.
Found this out by looking at the verbs in processstartinfo e.g.
dim psi as new processstartinfo("c:\quote.pdf")
for each verb as string in psi.verbs
debug.print(verb)
next
and by checking this via windows explorer by going into the Tools -> Options -> File Types tab and looking at the advanced properties.
Back to the drawing board for me on this one at the moment.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
After reading all of the posts, if you have to print PDF, look into something like GhostPDF.
We have a reporting solution (Business Objects) that has been in place for years. Of late, for WHATEVER reason, reports are now printing with the header and footer information removed.
Since we can save the reports via code in a PDF format, I tried using GhostScript yesterday to print the PDF document to the affected printers. Early results are encouraging.
Tim
|
|
|
|
|
I am working on a data based app. I have everything working to this point. when I go to insert a new record to the table I get a Null reference exception
.
Private Sub StudCount_Compute(ByRef result As String)
' Set result to the desired field value
result = (WallLenght & " " & Guage.ToString & " " & "Ga." & " " & WallHeight.ToString & " " & "Ft.")
End Sub
I'm unsure how to fix this, most likely it's a stupid thing I forgot to do.
Please show Me the error of My way's.
Thanks
Frazzle the name say's it all
|
|
|
|
|
frazzle-me wrote: WallLenght
I don't know about you, but that is not how i spell WallLength.
Not something as simple as that is it?
|
|
|
|
|
Maybe lol typo I'll check
Frazzle the name say's it all
|
|
|
|
|
WallHeight, Gauge, and/or WallLength are probably Nothing and not an actual object instance.
|
|
|
|
|
Sadly I also Misspelled it in the Data base(can You see the "L" on my forehead?)
Fixing all entries he say's while hanging his head low
Frazzle the name say's it all
|
|
|
|
|
Yep. WallHeight, Gauge, and WallLength are not defined or passed in as variables to your subroutine. I'm surprised that it compiles.
Using the debugger, step into the routine and examine the values of those variables. (you can do this by placing your mouse on top of the variable and the tool tip will show you the current value)
|
|
|
|
|
David Mujica wrote: I'm surprised that it compiles.
Option Explicit Off
Public Class Form1
Sub New()
InitializeComponent()
Text = CStr(Value_Of_A_Politicians_Promise)
End Sub
End Class
Bastard Programmer from Hell
|
|
|
|
|
Yep. I know that it could be done by using Option Explicit Off, but my VS environment has it set to default of "Explicit On".
Back in my days of programming Fortran on the VAX, we used to use some compiler directive which effectively forced you to declare all of your variable. I'm old school that way.
|
|
|
|
|
David Mujica wrote: <layer>we used to use some compiler directive which effectively forced you to declare all of your variable. I'm old school that way.
True, that's how things should be. Working without is asking for trouble, giving you a new and empty object when you have a typo in the variable-name.
..and it's not much extra work
Bastard Programmer from Hell
|
|
|
|
|
David Mujica wrote: I'm surprised that it compiles.
With 'Option Explicit Off', you're in for loads of surprises. Unfortunately, VB is often very forgiving.
|
|
|
|
|
Hi All
I am making a string from dataset and then converting to xml.while converting its giving me error unexpected symbol "=" at location
For Each row In dsGetBVItemDetails.Tables(0).Rows
strxmlString += _
"<ItemDetails>" & _
"<Item code=" + dsGetBVItemDetails.Tables
(0).Rows(i)(0).ToString() + ">" & _
"<Description>" +
dsGetBVItemDetails.Tables(0).Rows(i)(1).ToString() + "</Description>" & _
"</Item>" & _
"<ItemQty>" + dsGetBVItemDetails.Tables
(0).Rows(i)(2).ToString() + "</ItemQty>" & _
"<Message>" + dsGetBVItemDetails.Tables
(0).Rows(i)(3).ToString() + "</Message>" & _
"</ItemDetails>"
i = i + 1
Next
It is giving error while converting only when adding attribute "code" in element Item pls suggest
and then converting like this
XFinalXML = XElement.Parse(strxmlString.ToString())
xmlResponse = XElement.Parse(XFinalXML.ToString())
xmlResponseDoc = New XDocument(xmlResponse)
schemaResponse.Add(Constants.TARGETNAMESPACE, AppDomain
.CurrentDomain.BaseDirectory & "Schema\" & Constants.GetBVItemsResponse)
nsResponse = xmlResponseDoc.Root.Name.NamespaceName
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|
|
Are you adding double quote characters around the attribute value that follows "<Item code=" ? You can check this by looking at the generated string in your debugger.
The best things in life are not things.
|
|
|
|
|
yes below is my code
For Each row In dsGetBVItemDetails.Tables(0).Rows
strxmlString += _
"<ItemDetails>" & _
"<Item code=" + dsGetBVItemDetails.Tables
(0).Rows(i)(0).ToString() + ">" & _
"<Description>" +
dsGetBVItemDetails.Tables(0).Rows(i)(1).ToString() + "</Description>" & _
"</Item>" & _
"<ItemQty>" + dsGetBVItemDetails.Tables
(0).Rows(i)(2).ToString() + "</ItemQty>" & _
"<Message>" + dsGetBVItemDetails.Tables
(0).Rows(i)(3).ToString() + "</Message>" & _
"</ItemDetails>"
i = i + 1
Next
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|
|
No, you're not. The resulting string code should be closer to:
<Item code=""" + dsGet... + """>" & _
But, you shouldn't even be doing it this way. You're code is nearly impossible to read and makes it very difficult yo see what's going on. Look at my other reply.
|
|
|
|
|
To add to Dave's comments, you have ignored my suggestion and merely reposted the original code, minus the <pre> tags, so it's almost impossible to read. And it obviously does not include the double quotes; had you used your debugger you would have spotted that fairly quickly.
The best things in life are not things.
|
|
|
|
|
You're missing quotes around the value for code .
Concatentating string together to build an XML document is doing it the hard way and it's less forgiving of typos and invalid characters in the contents.
You might want to look into building it this way:
Dim xml As New XDocument
xml.Declaration = New XDeclaration("1.0", "utf-8", "yes")
Dim rootNode As New XElement("RootNode")
For index = 1 To 3
rootNode.Add(<ItemDetails>
<Item code=<%= index %>>
<Description>Some description text <%= index %></Description>
</Item>
<ItemQty><%= index %></ItemQty>
<Message>Item Message <%= index %></Message>
</ItemDetails>)
Next
xml.Add(rootNode)
Debug.WriteLine(xml.ToString)
Notice that any values are automatically put into quotes when needed. Plus, you get full Intellisense support and syntax checking in Visual Studio 2010.
|
|
|
|
|
Hi Every body...VANAKKAM..( good morning or afternoon or evening in Tamil Langauge)..I want to learn the basiclogic to create my own user control.
Please Guide me..
Selvaraj.G
|
|
|
|
|
In the IDE create a new User Control. Add controls to it and make sure all settings you require are persisted. Apart from that it's the same as creating a form.
You'd be better off learning how to create a controls in a language that hasn't been deprecated and is still supported. Move to .net; C# or VB.net.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
In the name of all that is holy, do not learn VB6.
Nobody uses it.
Switch to VB.Net.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
Hello every1
i want to make a program with vb2010 that can compare a wav file with a realtime recorded voice from microphone and triger something (lets say that a msgbox appear)if the microphone msg is closed to the recorded from a wav.
thnx in advance
speedydc
|
|
|
|