|
Utter spaghetti. There's stuff that there's no definitions for. Example: What's prnSelection.arrToInstall ? Where is it defined? How is it getting passed to this code, ...
And what's with this CallByName garbage?? Don't. Just put the printer names and the two command lines you need to run for them into an array and you can loop through building the command lines and launching them from that. If you think you need to use CallByName, you really need to rethink your design.
You may also want to look into changing the Process.Start commands. The .exe to run would be "Cscript" and "rundll32", not "cmd".
|
|
|
|
|
there are 4 forms in this project
(form 1) prnSelections - Has 18 checkboxes so the user can select what they wish and ONLY install those.
arrToInstall is an arraylist that is filled when the check boxes are check upon clicking the next button
(form 2) prnOverView - Doesn't show up here as it is just the middle man for the user to make sure of the printers
(form 3) prnProcessing - which installs the printers.
(form 4) prnWrapup - Another form just to show which have successfully been installed hince the reason I was looking for an easy way to check the port/printer has been created so I do not attempt to install it more than once.
CallByName is used to call the installation function because printer is the value of that particular spot in the arraylist.
I tried without the BGworker before, however the progressbar would not get filled as that is what I need.
I hope this clears up a few things of what I am trying to accomplish.
and do you mean Process.Start("Cscript.exe %WINDIR%\System32\Printing_Admin_Scripts\en-US\prnport.vbs -a -r CSE-211-CLQ -h at-cetus.ad.ufl.edu -o lpr -q cse-211-clq") ?
modified on Wednesday, October 29, 2008 10:07 AM
|
|
|
|
|
Trey5498 wrote: Process.Start("Cscript.exe %WINDIR%\System32\Printing_Admin_Scripts\en-US\prnport.vbs -a -r CSE-211-CLQ -h at-cetus.ad.ufl.edu -o lpr -q cse-211-clq")
No, I mean:
Process.Start("cscript.exe", """%WINDIR%\System32\Printing_Admin_Scripts\en-US\prnport.vbs"" -a -r CSE-211-CLQ -h at-cetus.ad.ufl.edu -o lpr -q cse-211-clq")
|
|
|
|
|
it brought up the cmd prompt quick, then went away and still never installed the port/printer. Here is what I changed it to:
Process.Start("Cscript.exe", """%WINDIR%\System32\Printing_Admin_Scripts\en-US\prnport.vbs"" -a -r CSE-211-CLQ -h at-cetus.ad.ufl.edu -o lpr -q cse-211-clq")
Process.Start("rundll32.exe", "printui.dll, PrintUIEntry /if /b ""CSE-211-CLQ"" /f ""C:\7760.inf"" /q /r ""CSE-211-CLQ"" /m ""Xerox Phaser 7760GX PS"" /z /u")
It is like it just ignores the arguments completely! I am using VS 2008 if that helps
|
|
|
|
|
I have a vb.net application, In which the use of MS ScriptControl invoke Perl app.
e.g:
-------------------------------------------
DIM MSS AS NEW SCRIPTCONTROL
MSS.Language = "PerlScript"
MSS.Reset()
MSS.AllowUI = False
MSS.UseSafeSubset = False
MSS.AddCode("Test")
////////////////////////////
PERL APP.
sub Test(){
$a=1;
$b=2;
$c=$a+$b;
print("This is a test!!!\n");
return $c;
}
------------------------------------------
This program can run normally, But I want perl app. print out the data!
How do i do?
|
|
|
|
|
I have no idea since I've never used the MSScript control. But, this line: MSS.AllowUI = False , looks like it may prevent you from doing what you want.
|
|
|
|
|
OK ,i'll try it again.
Thank you proposal
|
|
|
|
|
Hi guys
I am getting the following warning .
"Found conflict between the different versions of the same assembly"
any help
thanks in advance
hello
|
|
|
|
|
Google results for ""Found conflict between the different versions of the same assembly"[^]".
Basically, you have two parts of your solution that refer to the same assembly, but where setup using different versions of that assembly. If your familiar with ILDASM, you can use that to see which assemblies you're referencing are using different versions. But, in the end, you're just going to end up recompiling the dependant assemblies and your projects that use them.
|
|
|
|
|
Hi All,
I am using Enteprise Library Data Access Application Block (v 3.0 April 2007) in my application.I want to encrypt the App.config file. I have tried the bulit-in RSA and Data encryption metods in Data Access Application block.
It seemed that the user account who creates the encryption key only has the key to decrypt it. That means it's machine dependant.
Eg. If i encrypt the config file in my machine my collegue can't decrypt it in his machine. Is there any way that we can encrypt the file using a public key which is accessible to the other developers in the team? Can anybody suggest me a way to overcome this issue?
Thanx in advance,
Dinesh
|
|
|
|
|
The way I've gotten around this is to not ship an encrypted app.config. You encrypt the app.config using a custom action in the installer project. This encrypts the app.config file when the application is installed on the target machine.
|
|
|
|
|
I end up creating my own encryption routine to encrypt the data prior to getting written to the config. The key is skewed and the code is obfuscated for better protection; our apps are used by our internal employees only.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I just want to test first if my code is running so i rewrite everything and created a simple insert command, but it wasn't working right. When i update my adapter i had an error"syntax error in insert into" i don't know what code to edit or did i miss something?
please help. thanks.
Try
Dim myConnection As New OleDb.OleDbConnection
Dim myAdapter As New OleDb.OleDbDataAdapter
myConnection.ConnectionString = "Provider= Microsoft.Jet.OLEDB.4.0; Data
Source=C:\Desktop\vbnet\biblio.mdb"
myAdapter = New OleDb.OleDbDataAdapter("Select * from Titles", myConnection)
Dim ds As DataSet = New DataSet
Dim dr As DataRow
Dim drCommandBuilder As OleDb.OleDbCommandBuilder = New OleDb.OleDbCommandBuilder(myAdapter)
myAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey
myAdapter.Fill(ds, "Titles")
MessageBox.Show("Loaded data from Titles Table into dataset.")
myConnection.Close()
dr = ds.Tables("Titles").NewRow()
dr("ISBN") = "026"
dr("Title") = "Together Again"
dr("Year Published") = "2001"
ds.Tables("Titles").Rows.Add(dr)
MessageBox.Show("Inserted new row into Titles")
myConnection.Open()
myAdapter.Update(ds, "Titles")
MessageBox.Show("Sent update to db")
Catch Ex As Exception
Console.WriteLine("Error: " & Ex.Message)
MsgBox("Error: " & Ex.Message)
End Try
|
|
|
|
|
The problem is in your select statement. You told it to return all fields with the "*". The command builder can't construct an SQL statement using the "*". You have to specify the field names you're using in the SELECT statement so the command builder can figure out which values go in which fields when it builds the INSERT statement.
|
|
|
|
|
im new in using ole db and i could'nt solve my problem here. not sure if im missing some codes.
after clicking the save button and closing the program, when you open it again, the record will not show (not actually saved!). I need to add, edit and delete a record.
please help. thanks.
If strMode = "addmode" Then
dr = dt.NewRow()
dr("ISBN") = txtISBN.Text
dr("Title") = txtTitle.Text
dr("Year Published") = txtYear.Text
'dt = ds.Tables(0)
dt.Rows.Add(dr)
myAdapter.AcceptChangesDuringFill = True
dr.AcceptChanges()
dr.BeginEdit()
Me.myAdapter.Update(ds)
MessageBox.Show("Added new record!")
ElseIf strMode = "editmode" Then
'cm = currencymanager
dt.Rows(cm.Position).Item("ISBN") = txtISBN.Text
dt.Rows(cm.Position).Item("Title") = txtTitle.Text
dt.Rows(cm.Position).Item("Year Published") = txtYear.Text
Me.myAdapter.Update(ds)
MessageBox.Show("Record Updated!")
End If
Reply·Email·View Thread
|
|
|
|
|
Please don't repost the same question again.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
You might also want to get rid of that "AcceptChanges" line. You'll want to read up on it before you use it so you know exactly what it does and why it appears to be throwing out your changes.
|
|
|
|
|
I am using parallel port in my design project.May you please give me a detailed description how to do so.My I design is based on controlling the following outputs 12V stepper motor,buzzer and traffic lights(3 Leds).
I am using 2 motion detector (both main and the backup) to sense the train and pressure sensor to detect the car(this are my inputs).
Please help I am submitting this project on 3 of November2008.Please help I was trying since july.
modified on Monday, October 27, 2008 6:45 PM
|
|
|
|
|
One week to do this?? Good Luck with that! You'll find it very difficult to do this with the parallel port. Too limited in functionality and interfacing between the hardware and your code. You can do this much easier using USB devices. Check out Trossen Robotics[^], starting with a Phidgets board and the sensors and motor controllers they have.
|
|
|
|
|
im new in using ole db and i could'nt solve my problem here. not sure if im missing some codes.
after clicking the save button and closing the program, when you open it again, the record will not show (not actually saved!). I need to add, edit and delete a record.
please help. thanks.
If strMode = "addmode" Then
dr = dt.NewRow()
dr("ISBN") = txtISBN.Text
dr("Title") = txtTitle.Text
dr("Year Published") = txtYear.Text
'dt = ds.Tables(0)
dt.Rows.Add(dr)
myAdapter.AcceptChangesDuringFill = True
dr.AcceptChanges()
dr.BeginEdit()
Me.myAdapter.Update(ds)
MessageBox.Show("Added new record!")
ElseIf strMode = "editmode" Then
'cm = currencymanager
dt.Rows(cm.Position).Item("ISBN") = txtISBN.Text
dt.Rows(cm.Position).Item("Title") = txtTitle.Text
dt.Rows(cm.Position).Item("Year Published") = txtYear.Text
Me.myAdapter.Update(ds)
MessageBox.Show("Record Updated!")
End If
|
|
|
|
|
Are you using an Access database?? Does this happen running your code deployed to a test workstation??
If not, then it's probably because your orignal copy of the database is getting copied to the bin\Debug or bin\Release folders every time you compile your app. You run your app in the debugger and make some changes. Those changes are written to the copy of the database in the bin folder. Once you stop your app and rerun it, those changes are probably getting overwritten because Visuaal Studio is copying the .MDB file to the bin folder again, over the top of your changed .MDB file.
|
|
|
|
|
Yes im using access.
so what will i do? should i change my codes? it doesn't give an error message and i can't trace anything wrong.
Thanks.
|
|
|
|
|
That's because there's nothing wrong.
Open the project in the Solution Explorer and look for your .MDB file. Click once on it, then in the Properties box, there'll be an option called "Copy to output directory". Change it's value from "Copy always" to "Copy if newer". That way, if you delete the copy of the database file in the bin folder, Visual Studio will replace it the next time you compile the project.
|
|
|
|
|
I'm trying to use .Net 3.5's NamedPipeServerStream and NamedPipeClientStream and I'm having some problems. I'm able to send one commmunication between the client and server programs but when the client attempts to connect a second time it hangs. Any idea what I'm doing wrong?
SERVER CODE
-----------
Imports System
Imports System.IO
Imports System.IO.Pipes
Imports System.Threading
Imports System.Windows.Forms
Public Class SimServer
Private Delegate Sub InvokeDelegate(ByVal text As String)
Private newThread As New Thread(New ThreadStart(AddressOf PipeServer))
Private Sub PipeServer()
' Read the request from the client. Once the client has
' written to the pipe, its security token will be available.
Dim pipeServer As New NamedPipeServerStream("CognexPipe", PipeDirection.InOut, 10)
Dim sr As New StreamReader(pipeServer)
Dim sw As New StreamWriter(pipeServer)
Dim line As String
Dim retline As String
While (1)
pipeServer.WaitForConnection()
sw.AutoFlush = True
While (pipeServer.IsConnected)
If (sr.Peek > 0) Then
line = sr.ReadLine()
Me.BeginInvoke(New InvokeDelegate(AddressOf TextHandler), line)
retline = "Received: " + line
sw.WriteLine(retline)
End If
End While
End While
End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
newThread.Start()
End Sub
Private Sub Form3_Close(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.FormClosing
newThread.Abort()
End Sub
Public Sub TextHandler(ByVal text As String)
ReceivedBox.Text = text
ReceivedBox.Update()
End Sub
End Class
CLIENT CODE
-----------
Imports System
Imports System.IO
Imports System.IO.Pipes
Imports System.Threading
Public Class SimClient
Private Sub SendButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SendButton.Click
Dim pipeClient As New NamedPipeClientStream(".", "CognexPipe", PipeDirection.InOut)
Dim sr As New StreamReader(pipeClient)
Dim sw As New StreamWriter(pipeClient)
Dim line As String
Dim retline As String
If Not pipeClient.IsConnected Then
pipeClient.Connect()
End If
If pipeClient.IsConnected Then
sw.AutoFlush = True
line = CommandBox.Text
sw.WriteLine(line)
While sr.Peek = 0
End While
retline = sr.ReadLine()
ResponseBox.Text = retline
ResponseBox.Update()
sw.Close()
sr.Close()
End If
End Sub
End Class
Thanks for any help you all can give me.
George
|
|
|
|
|
Based on what I can see from the code without actually compiling it, I would guess that either the server code is blocking on the line If (sr.Peek > 0) or the thread is throwing an Exception when the pipe closes and ending that thread.
|
|
|
|