|
Hi,
I think I am getting mixed up. The question I meant was "How can I set the code so that my printer does not print duplex"
What is the syntax and what class do I import. It has been a long time since I did any real coding and I am a wee bit rusty. You can properly tell with this question...getting old.
|
|
|
|
|
If you click on the second link in my first reply and scroll down to the answer from 'JWolf011' and look at the code he has posted.
You have not show us the code you are using so I cannot tell you exactly where you should put that code but for an example suppose that you have a Button to turn off Duplex. Double-click the Button to get the template for its Click handler in your code window.
Inside the new handler type the code from that link (leave out the two Debug.Print lines, if you like and you must change mo.SetPropertyValue("Duplex", True) to mo.SetPropertyValue("Duplex", False) ).
Then when you run your application and click that Button it should turn off Duplex. Then do your normal printing.
If it works then move the code into your normal print routine.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
|
|
|
|
|
I tend to install duplex capable printers twice, once for simplex, and once for duplex. Then it is all a matter of choosing the right printer.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Hi all
I have a ms access database with few tables. I nned to draw a graph/chart using the tables in excel.
Is it possible to do with vb.net coding?
If possible, any suggestion and references will be very much helpful.
Thanks in advance.
|
|
|
|
|
|
Thanks for the link.
Will checkout.
|
|
|
|
|
I have combo box that is loaded dynamically. When the user select Misc from the list I want to unhide a text field. I recived the following error.
System.NullReferenceException: Object reference not set to an instance of an object.
at ACEPackaging.dlgEditSkidWeight.HideCarrerTextBox()
etc
etc
etc
Here is my code that is called when the user changes the selection on the combobox.
If CStr(cboCarrier.SelectedValue.ToString) = "99" Then
tbCarrierDesc.Visible = True
Else
tbCarrierDesc.Visible = False
End If
End If
I did a little research and said that this error is caused by the .ToString being Null or Nothing. So here is what I have added to correct the problem so there are no more errors. Please let me knwo if this will work.
If Not cboCarrier.SelectedValue.ToString Is Nothing Then 'added this line
If CStr(cboCarrier.SelectedValue.ToString) = "99" Then
tbCarrierDesc.Visible = True
Else
tbCarrierDesc.Visible = False
End If
End If
|
|
|
|
|
ToString being Nothing wouldn't cause that problem... More likely, SelectedValue is the problem. Also, Using CStr on something that's already gone through ToString is redundant... A better way would be:
If Convert.ToString(cboCarrier.SelectedValue) = "99" Then
tbCarrierDesc.Visible = True
Else
tbCarrierDesc.Visible = False
End If
As Convert.ToString can handle a null/Nothing argument, and would just return "".
|
|
|
|
|
What if the object hasn't been set?
|
|
|
|
|
If SelectedValue is nothing, Convert.ToString will return an empty string.
If the object itself is nothing, you'll still get the error... But I'm assuming this is just a named control, which would be set as soon as the window/form is instantiated.
|
|
|
|
|
Assuming your ComboBox list does not hold any item that is Nothing, this should do:
tbCarrierDesc.Visible = cboCarrier.SelectedIndex >= 0 AND cboCarrier.SelectedValue.ToString = "99"
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
CStr(cboCarrier.SelectedValue)
Won't throw an exception.
cboCarrier.SelectedValue.ToString
Might throw an exception if SelectedValue is Nothing , since you can't call a method on an object if the object isn't there.
Hence, we can say;
CStr(cboCarrier.SelectedValue.ToString)
Might throw an exception, since the ToString will be evaluated prior to the CStr function.
I are Troll
|
|
|
|
|
Dear all,
I am rather new to the exciting world of software development (i do not consider myself a developer but merely a visitor in the field) and have some fundamental questions to express in order to make things strait in my mind.
I would like someone to answer the general steps in developing an application.
In my mind the steps would go something like:
1. Analyzing the needs of the solution and prepare any relevant documentation on the to-do stuff.
2. Recognize the new classes that has to be developed (based on the previous analysis) in order to achieve the required functionality
3. Develop the code & tight the variables and relevant documentation (help docs etc)
4. Test the code for possible errors (internal test) and return to step 3 for any changes
5. Issue the final release
Questions:
1. Are these steps correct?
2. Is it a necessity to develop new classes? Couldn't one use already developed classes or just subs and functions reside in some modules?
3. What percentage of total-time would each one of the development phases take?
Best Regards
|
|
|
|
|
Hi,
You are correct to some extent. You can move on to develop a software following the steps :
1. Analyzing the needs of the solution and prepare any relevant documentation on the to-do stuff. (Requirement Gathering)
2. Identify the Design Pattern, Technology etc. to be used for the development considering the scenario, requirements.
3. Once you are done with this, you can move on to prepare the prototype of the application. i.e. The general skeleton of the
working model of the software.
4. Develop the code with OOP concepts. i.e. Modularity, Re-usability etc.
5. Test the code as you develope. It is a good habit to test the code at every level.
6. Give the first release to the client. (User Acceptance Testing)
7. Let client evaluate your software. If they are ok with the functionality and everything, Prepare the final release (GO Live!!!!)
For more info refer :
http://www.exforsys.com/tutorials/programming-concepts/software-development-life-cycle.html[^]
Is it a necessity to develop new classes? Couldn't one use already developed classes or just subs and functions reside in some modules?
Ans : Software Developers follow the principle of Re-usability. i.e. You develop the modules in such a way that they can be used from some other
applications also. It reduces the time needed to develop the softwares. You should not start from scratch always. Always look for the
pre-developed components and make use of them.
What percentage of total-time would each one of the development phases take?
Ans : There is no clear answer to this question. It totally depends on the size of the software. Sometimes it is task of month, sometimes even
the years are less to complete the development.
|
|
|
|
|
Since Pravin has already set some things straight I'll just tell you this, with your 5 point plan you've already shown me to be a candidate to be a good developer someday. I deal with people that think they are developers on almost a daily basis and they still haven't grasped the concepts you roughly outlined.
My advice to you: Never stop learning, never stop improving on your skills!
|
|
|
|
|
It is not always necessary to develop new classes, but that is better than creating slow bulky classes that are very general.
This depends on your role and the organization. In general (assuming you are not doing complicated multi-threading), you are NOT going to spend as much time on documentation unless you are a low level grunt or you are a system architect giving high level instructions to your subordinates.
Your code should be self-documenting with variable names that make sense unless your aim is to try to increase job security by writing code that no one else understands or wants to use.
|
|
|
|
|
hahaha
I have never thought of that side effect concerning the use of the variables...!
Thank you all for your enlightening opinions.
|
|
|
|
|
I didn't find a suitable forum to ask this so I ask for your superior experience and knowledge.
I have been commended the task of building some sort of "automation" for one report we usually hand in the form of units required to satisfy a given demand on a given product. All needs to be done in Excel though
So, situation is like this:
I have an spreadsheet which contains the given demand of a finite number of artifacts, handled by product code, and with dates and expected pieces for this dates:
Model 4-Jan 11-Jan 18-Jan 25-Jan 1-Feb
WFW8300SW 198 11 20 35 0
Each product code has a corresponding catalog of components for this product, which goes in another spreasheed given the following format:
WFW9550WL
item description qty
W10270180 Some silly piece of Machinery 1
This spreadsheet contains all product codes and component codes in the same 3 columns.
Finally, in this same second workbook, there is an spreadsheet which contains the components for the component code's component! ( ) in the following arrangement:
PartNo Description Supplier Family W10159465 W10261477 W10074160 8540050
W10270180 PPGV30 WPenn Family1 5 10 0 1
What is the expected result? Easy, the amount of pieces of pieces's pieces and their codes of course XD
First of all, could it be possible to do in VB for Applications alone? May be that is late at night but I got stuck on here. I'm also trying with a Office solution but may be lack of understanding of the component model that I haven't figured this out. If you have any suggestions, all are well accepted
If I come with a solution before, I'll let you know and even post the resulting code in case anyone faces a similar requirement
Thanks CP! Good night, and good luck!
moved on Wednesday, January 19, 2011 2:04 AM
modified on Wednesday, January 19, 2011 9:59 AM
|
|
|
|
|
You are looking at a Bill of Materials.
Each Top Level Item Has a Collection of Children, who have themselves a collection of children. That should give you a clue.
Class SomeProduct
Public _components As List(of Component)
...
End Class
Class Component
Public bom As List(Of things)
End Class
Class Components
Inherits List(Of Component)
...
End Class
...
Use something like this and populate from the data to build the report? Very easy to do with a "real" database.
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
Hi,
I have developed an email program to send emails to users at end of the daily based on the data I have in database. I want to schedule this program in a PC. When I did a test run from that PC I could not get mails from my program. But it is working fine on another computer. Could anyone let me know what are the system requirements for my email program to work correctly. To my uunderstanding we should have SMTP server. How to install/configure SMTP server on the PC.
my email code is as follows
Dim iMsg As New CDO.Message
Const cdoSendUsingPort = 2
' Apply the settings to the message.
With iMsg
.To = Recipient
.From = Sender
.Subject = Subject ' "This is a test CDOSYS message (Sent via Port 25)"
.HTMLBody = strHTML
.Send
End With
Regards,
Uma
|
|
|
|
|
That depends on the user account your app is running under. For example, if you're using Exchange, you need to setup an Exchange account for the user account that your app is running under.
|
|
|
|
|
We are using exchange server. thank you for your response.
Regards,
Uma
|
|
|
|
|
It's not usual to find the answer within the question:
Uma Kameswari wrote: .Subject = Subject ' "This is a test CDOSYS message (Sent via Port 25)"
So, prerrequisite for this code: port 25 must be opened.
But port 25 is not usually opened. Some ISP's close it to avoid spam so I guess you should try another port, and maybe SSL, to make sure your emals will be sent. There are several articles here at Code Project that might help you. Search "SMTPClient" and have a look.
|
|
|
|
|
Hello to everybody!
I managed to write a VB6 application an context sensitive help.
I am able to call and open the correct page inside the CHM file.
I am using the code found at http://support.microsoft.com/kb/315988[^].
When I open directly the CHM file from explorer, it will work, and in the search tab I can enter text and get results.
Now to the problem: when opening the same CHM from the application (F1), the search tab is there, but no text can be entered.
I have also a page inside the CHM with some java script and an form with input type="text". This works fine opening the CHM directly, but when called from the VB6 application, I can press form button it will execute the onclick event, but I can't enter a value in the textbox (in other words: java script itself is not blocked).
MJsDiag reports no problem. I tried also http://www.ec-software.com/products_hhreg.html[^]
So I think the problem is not the CHM but somewhere else.
Any Ideas?
Edit: sometimes, starting from the VB6 application, if I open the CHM, close it and open it again the search start working.
I did not found how exactly reproduce this systematically...
I am calling the CHM from a DLL, I have a helper class where in the Class_Initialize() I initialize the help system like this:
App.HelpFile = App.Path & "\help_file.chm"
Call HTMLHelp(objForm.hWnd, App.HelpFile, HH_INITIALIZE, ByVal "starting_page.htm")
It seems that if I start the application and just use the mouse and hit F1 it's not working, but if I type before something and then hit F1 it works????
Can, Could this be?
Edit2:
Added this code to the form load routine: now search in help works....
Me.Visible = True
txtBox.SetFocus
Strange world, can someone give me an explanation of this behavior?
modified on Friday, January 14, 2011 11:48 AM
|
|
|
|
|
Hi, I have Win XP Pro SP3, and one of the command line programs I regularly run has an initial message which requires the user to press a key to get past it; and it doesn’t accept keyboard redirection, i.e. something like “program.exe < cr.txt” at the command prompt doesn’t get past the message.
In VBscript I have found that the following usually works:
Set oShell = WScript.CreateObject("WScript.Shell")
oShell.Run "program.exe arguments & pause"
WScript.Sleep(3000)
oShell.Sendkeys"{ENTER}"
(despite a VBSCRIPT book I have saying that Sendkeys can’t be used to send keystrokes to a non-Windows application).
However once in a while the program generates a whole lot more initial messages and takes more than 3 seconds to get to the point when you can press a key, and if possible I want to expand the script to run the program a second (and third, and …) time, after the first run finishes.
Hence, is there some way for the script to be able to “read” the text in the command prompt window generated by the “oShell.Run” statement and search for “press any key to continue” (or similar), before issuing the sendkeys method (and similarly, search for an “end of program” type message before running it again)?
I also have VB6, so if there is some way to do this in VB6 but not VBscript, I could change to using VB6.
|
|
|
|