How to setup daily script to disable USB port in window - usb

I'm new on this & trying to get some help from the expert here how to setup this.
I'm like to create a batch job to run every morning in window 11 to disable the USB port by changing the data value to "4".
Notice the value changed back to default during restart after every window update.
Under registry editor as
"Computer\HKEY_local_machine\system\currentControlSet\Services\USBSTOR"
name = "Start"
Type "REG_DWORD"
action is to change the value data from "3" to "4".
Thanks all in advance who can help on this.

Related

Automatic Scroll SAP GUI

I'm trying to scroll until the end of the page and I recorded a script and did some changes. I thought of something like that
For i = 1 To END_PAGE
session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").setCurrentCell i, "AUFNR"
Next
Where "AUFNR" is the name of the column I'm analyzing. But how do I know the END_PAGE if the code stops working when it checks a line it doesn't exist?
Here is a screenshot of the table I'm analyzing in SAP GUI
For example I could verify if EACH element has a text but unfortunely I don't know how to do that. Any ideas?

Increment a database value after printing a report

I have a database table with just one column, invoiceNumber. This is displayed on a Crystal Report to show the unique number of the report (as it's an invoice).
At the moment, for all of the reports, when viewing them in vb.net, the number being displayed is 1, because that's what the value in the database column is.
What I want to know is, how can I increment the number after and only after the report has been printed (if they cancel the print job it doesn't increment, for example).
I know this is usually simple, it would use SQL after the print code on the button press, however, in the project, I am using a CrystalReportViewer so printing isn't done on a button click, and I don't think the printing in a CrystalReportViewer can be programmed separately?
So how and where do I code the value in the database table to incremement by 1 after the report has printed? Is this even possible?
I would also suggest using a confirmation button for the user to confirm they have printed it OK. No other way to be sure it came out of the printer without jams, smudges, creased paper etc etc
Pseudocode
EventHandlerWhichTriggersReportCreation
Call code to initiate and load CrystalReportViewer
Display dialog/prompt asking user if all printed OK
If all OK, increment counter
You can use a flag which is set on acknowledgement after print is successful.
In another function you can check if flag is set and increment the flag accordingly.

Dirty on command?

I have an Access 2010 application that has a form with a text box and a command button on it. Clicking the command button places a default value in the text box.
Question: When a user clicks the command button I can either:
Run an SQL update to save the new text box value in the data source that it is bound to plus set the me.textbox1.value to its new value, or
Run the same SQL update to save the new text box value in the data source that it is bound to plus do a form.requery?
Which is better? Would changing the bound value in the data source initiate a current event and an automatic requery?
Thanks in advance.
If you want to save the entry immediately, I would write the value to the text box, and do
Me.Dirty = False
to save the record in the bound form.
I see no point in doing this via SQL.
Would changing the bound value in the data source initiate a current event and an automatic requery?
No, that would actually be the worst method. The form wouldn't know about the changed data source, and once the user would start editing, he would get the "Write Conflict" message.
Your 1. would have the same problem.

Unable to push bound control changes to the dataset

I am trying to compare the original and current value for a data bound text box. I've done a bit of research and tried a few methods but I can't seem to get it to work. I'm using vb.net via Visual Studio 2012. Database is running on a SQL 2012 server and I'm using a stored procedure to provide the data.
Fill statement:
Me.SpGetEmployeeTableAdapter.Fill(Me.DsEmployee.spGetEmployee, cboEmpId.SelectedValue)
My textbox is called txtLastName and txtLastname.Text is bound to spGetEmployeeBindingSource.LastName
I have a method that handles txtLastName.LostFocus so I can watch the values as follows:
Private Sub LastName_Out() Handles txtLastName.LostFocus
Dim x as String
x = "Hi" (breakpoint)
End Sub
I run the app and load the data for employee Smith using the fill above. I go to the text box, change it to Jones and tab out. I hit the break point above and check the values in a Watch window:
me.DsEmployee.spGetEmployee(0)("LastName", DataRowVersion.Original).ToString
me.DsEmployee.spGetEmployee(0)("LastName", DataRowVersion.Current).ToString
Both lines show Smith as the value but on the screen you see Jones.
My research indicated that I may have to run EndCurrentEdit to push the textbox.text value down to the dataset but I've had no luck. The following are three examples of how I tried to end the current edit but so far the values stay the same and the dataset doesn't pick up the changes:
BindingContext(Me.DsEmployee.Tables.Item("Me.DsEmployee.spGetEmployee(0)")).EndCurrentEdit()
BindingContext(Me.DsEmployee.spGetEmployee.Rows(0)).EndCurrentEdit()
BindingContext(Me.DsEmployee).EndCurrentEdit
I have no doubt at all that I'm doing it wrong but I sure would appreciate a leg up.
Thank you!
I ran a couple of tests and actually got this working. Here is what I needed to do before testing the "Current" data row version:
me.SpGetEmployeeBindingSource.EndEdit()
Once I ran that line of code I could test for the value in DataRowVersion.Current and I could see the new value. Additionally when I check me.dsEmployee.HasChanges it returns True when it returned False without the EndEdit.

Upadate text in text box using Microsoft Visual Studio 2010

i want to set text as default on text box and it will be update for each starting after that using vb.net 2010. as example, i need to process out progress for a stock.the default value of stock is 30, so at the first log in, value text box will show 30 as the number, user will run out process (default number - out number = result), result will be show. then if user login for next time, it will update the number as result number at the first process.
Use the (ApplicationSettings) node in the Properties window to create a setting and bind it to the Text property of the TextBox. That way, value in the control will be saved to the user config file at shutdown and loaded at startup automatically.