|
Would like to ask if anyone knows wat is the command for copying file from one folder to another non-stop?
|
|
|
|
|
Command for Copying file
My.Computer.FileSystem.CopyFile("C:\Source.txt", "C:\NewFolder\Dest.txt")
i don't understood the meaning for Non-stop
Thanks & Regards
Rajesh B
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Because i am doing a application on housekeeping. I need my hard disk space to be 80% full and test if my application is working therefore i need to keep copying file to my specify folder so that the disk space can be 80% full and allow my application to stop working. By using the way u told me i can only copy 1 specify file at a time only. Or is there a command whereby i am able to create dummy file with example like .ppt?
|
|
|
|
|
|
You could always create and open a text file and continue to append text to it, in a loop, until it reaches the desired size.
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
That's going to be a HUGE file (don't know if notepad even opens that, have to test it as soon as I come home )
|
|
|
|
|
just put the code in a loop and add a variable to the copyto path
dim i as integer = 0
do while i < 1000
My.Computer.FileSystem.CopyFile("C:\Source.txt", "C:\NewFolder\Dest" & i & ".txt")
i+=1
loop
this will copy the same file a 1000 times
you could ofcourse check the harddisk space available and stop if it reaches 80% but I think that would take this to far if it's jut for testing purposes
|
|
|
|
|
A for..Next loop would be cleaner
For i As Integer = 1 to 1000
My.Computer.FileSystem.CopyFile("C:\Source.txt", "C:\NewFolder\Dest" & i & ".txt")
Next
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
True
Must be from looking at an ex-collegue's code all day (nothing but while true loops), it's driving my crazy
|
|
|
|
|
ok thanks for all the help guys... i will try it out tomolo when i reach office...
|
|
|
|
|
Dear all,
I'm using a main module to shared all the Public variable and certain main component that my system is running. I'm using VB.NET using Visual Studio 2003 connect with MySQL 5.0 database. My system is running with Window Form Application which is a small Point Of Sales System used by my sister grocery shops.
Problems that facing by me now is the module doesn't continue running after I used System.Windows.Forms.Application.Run(FrmLogin) inside my main module class. The following are the code used:
<br />
Sub Main()<br />
TerminalLocate = ConfigurationSettings.AppSettings("Location")<br />
TerminalID = ConfigurationSettings.AppSettings("Terminal_ID")<br />
<br />
If TerminalLocate = "" Then<br />
MessageBox.Show("No Location Detected !")<br />
Exit Sub<br />
End If<br />
<br />
If TerminalID = "" Then<br />
MessageBox.Show("No Terminal Detected !")<br />
Exit Sub<br />
End If<br />
<br />
Dim FrmLogin As New FrmLogin 'FrmLogin is used for user verification for the system login.<br />
FrmLogin.Visible = False<br />
FrmLogin.WindowState = FormWindowState.Normal<br />
System.Windows.Forms.Application.Run(FrmLogin)<br />
<br />
<br />
'--------------------Code after this line never run anymore---------------------------------------<br />
While UserLoginSuccessful = True<br />
<br />
Dim clsReceipt As New clsDBReceipt<br />
clsReceipt.FindLastReceipt(TerminalLocate, TerminalID)<br />
MessageBox.Show("The Receipt number =" & strReceiptNo1 & " ")<br />
End While<br />
<br />
End Sub<br />
Anyone can give me some idea how to get back the system to run back to my module and do the continous task inside my module? My next task is to get the last receipt and transaction number from the database.
Thanks for reading and hope someone can help me soon.
Regards
Drex
|
|
|
|
|
Hi Drex,
I believe your problem lies in creating another process to run your login form.
I believe you can call your login form by calling the "ShowDialog" method. Here is a way to do it:
Dim frm As FrmLogin
Dim dlgResult As DialogResult
frm = New FrmLogin
dlgResult = frm.ShowDialog
If dlgResult = Windows.Forms.DialogResult.OK Then
'---- do your receipt check here
End If
You would need to implement logic in the login form to return "Windows.Forms.DialogResult.OK" ONLY if the user logged in correctly.
Also, I strongly recommend that you not do the "While" loop to check for your receipts. VB is perfect for using event - that is, do not loop infinitely - respond to events that happen in your application.
Calling the login form how I have above will help get you there. You could even raise an event when the user has successfully logged in, and then do your receipt check.
Hope that helps.
Regards,
Grant
__________________
Grant Porteous
Your Software Licensing Guide
http://www..SerialKeyMaker.com
|
|
|
|
|
Hello Grant Porteous and all,
I am sorry for my late reply here because my internet connection down for the past few days here. I have try to put the code into my system but I have no idea how should I return a result of Windows.Forms.DialogResult.OK from my Login form. How should I return it from my Login form to my main module to run the continues data about the receipt after the user login verification?
What I did now in my project is after user login verification successful,I'll Hide the Login form and directly pass the main form which is the Point-Of-Sales form (FrmPOSTerminal). I would like to know am I doing the right design for my system to pass the directly after the verification inside my Login form to my main form Point-Of-Sales form or I should hide my Login form and
open my form using the Sub Main Module??
Hope someone can give me some idea about this. Thanks for reading.
Regards
Drex
|
|
|
|
|
We do the login and validation BEFORE we do the application.run(frmmain).
Display Login form which does the user validation and returns a boolean (and in our case a table of permissions)
If the user is validated then do the application.run to your main form, presumably your POS entry point.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello Mycroft and all ,
Currently my system is directly running the Main Module to do everything here. I use this design because I allowed the user to do some counter setting when the system loads. The user can change the receipt setting such as receipt starting number,counter name,receipt allignment and the selection of database profile as what I'm trying to develop it now.
But I'm still wondering am I doing the right design for this? Because I read some forum said that we shouldn't used the Main Module anymore in order to make our system totally object oriented. So,do you all have any idea about using Main Module for VB.NET langguage on doing window form application system??
Hope to hear someone opinion here about this. Thanks for reading.
Regards
Drex
modified on Sunday, July 27, 2008 11:51 PM
|
|
|
|
|
Hello all,
Can somebody help me with this.
I have a BindingNavigator and DataGridView both are looking to the same BindingSource.
The BindingNavigator works fine.
When I do a RowFilter on the DataTable and I set the DataGridView.DataSource to the filterd DataTable the content in the DataGridView is filtered but the BindingNavigator doesnt work anymore.
The record count in the BindingNavigatorCountItem has it’s old value and the navigation buttons don’t work on the DataGridView.
How can I set the BindingNavigator to the filtered DataSource or How to sync it with the DataGridView?
To get the CountItem correct BindingNavigator.BindingSource.DataSource = Filtered DataTable
But the Button's stil don't work
Thanks,
Marco
|
|
|
|
|
To answer my own question...
Only do a filter on BindingNavigator.BindingSource.Filter
|
|
|
|
|
I have a legacy VB6 application that needs to use a .NET component.
I am attempting to pass values to the component, but continually get the message "wrong number of values or invalid property assignment".
Any help would be appreciated in terms of:
resolving error or
determining how to pass values correctly or
using properties for the componenent instead
It would have been nice to be able to test the solution in advance, but, this is a production environment and the required equipment was not available until today.
Thanks,
Tim
|
|
|
|
|
I think (I have not done thissince 2002) that the .Net component has to have a com wrapper to make it accessible by VB6. This is an option when building the component.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi, I made a application which connect to microsft outlook via MSMAPI32.DLL.
i have deployed this application in the client machine.
When this application try to access microsoft outlook. it give error :
Creating an instance of the COM component with CLSID {00000010-0000-0010-8000-00AA006D2EA4} from the IClassFactory failed due to the following error: 80040112
I dont know what to do with this problem. I checked all the dependencies of MSMAPI32.DLL. All dependencies are available in the client machine.
Kindly help me.
hi, this is anirudh
|
|
|
|
|
Why are connecting to Outlook via MSMAPI32.DLL? Why not reference the Outlook APIs?
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
Dear Steve,
Thank you so much for quick response. There is always some problem occurs when using vb6 component in vb.net. However Outlook APIs can be used, but it does not solve the problem regarding using vb6 component to .net.
Kindly guide me so that i am able to use this dll in VB.Net.
hi, this is anirudh
|
|
|
|
|
First off, I'm in the "skilled hobbyist" category - I don't do this for a living and my apps are not commercial apps. However, I've distributed some of my apps to colleagues who in some cases find them very useful. My question (when I get to it) will concern: how do I make sure what works on my machine will work on their machines?
I am coding an app that is working fine for me. Its job is just to create "recipes" for mixing chemical solutions. Really it's a glorified calculator, but with time-savers like allowing you to save molecular weights of commonly-used chemicals, jumping to websites that contain chemistry databases, organizing your library of chemicals by user-defined groupings, etc.
One can just run the calculations and write down the results. But I decided to provide a way to store recipes in a log - you can run several calculations and build a document of the recipes for saving or printing. Rather than code a mini word processor, I decided I'd just have the code open Microsoft Word. Now, to questions:
In my program I declare a global variable:
Public log As Word.Application
I noticed if I declared this "as new" then Word began running in the background. So in the File... Open log even of the menu, the code is:
btnCopyToLog.Enabled = True
Try
log.Visible = True
Catch
Dim openit As New Word.Application
log = openit
log.Visible = True
openit = Nothing
End Try
log.Documents.Add()
I'm doing it this way to get the global variable to reference the Word app. I probably will wrap this all in a Class once I have a clear vision of how it all will work. Right now, the btnCopyToLog Click event has another Try...Catch to write text to the ActiveDocument. The Form Closing event sets log to Nothing.
My question is this: it works for me. But if I send it to another person who doesn't have Microsoft Word 2003, what will happen? Will the app fail to run because there is a reference to the Microsoft Word 11.0 library? Or will the app run but throw a run-time error at the "log" variable declaration? (Is this fatal since declarations can't be error trapped?) Or will the app only throw an error when the variable is used? (In which case I can error trap it.) What if the user has a newer or older version of Word?
Thank you in advance for any guidance you can offer. I can always make my own log window with a rich text box if need be. But I'd also like to learn more about the issues involved, since I plan another program that will rely on Excel.
|
|
|
|
|
Steven,
IIRC, I believe it is required that Word be installed on the computer for that to work. I used to have that documented somewhere but I can't find it right now.
|
|
|
|
|
I'm sure that's true! What I'm wondering is what the behavior of the program will be. If there's a way for the program to discover if Word is on the machine I'd like to programmatically provide a different option to the user. (E.g., if a Word command fails then copy the text that would have gone to word to the clipboard, or generate an appending log text file.)
UPDATE:
Won't matter for the question I don't think, but I've encapsulated all of the Word operations into its own class.
|
|
|
|