By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,600 Members | 1,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,600 IT Pros & Developers. It's quick & easy.

Trying to run a program using a Queue.

P: n/a
I am trying to write a little app that will perform unattended installations
of various software packages. I have a text file, each line is a string
containing the complete command to start a silent/unattended install. I
have successfully read the entire file and each line gets added to the
queue. On this line "myProcess.StartInfo.FileName(myQ.Dequeue)" i get an
error: C:\Documents and Settings\tmoffett\My Documents\Visual Studio
Projects\HandsOff\Module1.vb(36): Property access must assign to the
property or use its value.

Is there a better way to go about this?
Thanks in advance.

Imports Microsoft.Win32

Imports Microsoft.VisualBasic

Imports System.Collections

Imports System.IO

Imports System.Object

' Run the program

' read the first command from the queue

' run the command

' remove the item from the queue

' set automatic login information

' reboot

' rerun the program until the queue is empty

Module HandsOff

Public Sub main()

Dim fs As New FileStream("c:\HandsOff.txt", FileMode.OpenOrCreate)

Dim sr As New StreamReader(fs)

Dim line As String

line = sr.ReadLine()

Dim myQ As New Queue

Do Until line = Nothing

myQ.Enqueue(line)

line = sr.ReadLine

Loop

' Displays the properties and values of the Queue.

Console.WriteLine("myQ")

Console.WriteLine(ControlChars.Tab + "Count: {0}", myQ.Count)

Console.Write(ControlChars.Tab + "Values:")

PrintValues(myQ)

Do While myQ.Count > 0

Dim myProcess As New Process

myProcess.StartInfo.FileName(myQ.Dequeue)

myProcess.Start()

'Shell(myQ.Dequeue())

'Registry hacks to enable automatic logon upon reboot

AutoLogon()

'Registry hacks to enable this program to start upon logon.

RunOnce()

'Reboot the computer.

Shell("shutdown.exe -r -f -t 05")

Loop

'Registry hacks to disable automatic logon upon reboot.

UndoAutoLogon()

End Sub
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Ty,

myProcess.StartInfo.FileName(myQ.Dequeue)

StartInfo.FileName is a Property as mentioned in the error message. This
means that its like a variable and must be used as such (use its value
somewhere or set it).

The line above is simlar to this:
Dim sYourName
sYourName ("Ty")

I'm sure, looking at this with an ordinary string, you can see that it's
wrong and should be:
sYourName = "Ty"

Simlarly you need:
myProcess.StartInfo.FileName = myQ.Dequeue

Regards,
Fergus
Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.