|
josephls wrote:
Add another entry at that point.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi.. Am Trying disable taskmanager through button click in vb.net but it gives me error .
registry access is not allowed.
But i have logged in as ADMIN only..
Below is the code am using....
Dim systemRegistry As RegistryKey = Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\System")
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
systemRegistry.SetValue("DisableTaskMgr", 1)
systemRegistry.Close()
End Sub
|
|
|
|
|
If you're getting "Access Denied", you're not running the code as an Administrator.
Since you're putting the value under CurrentUser, this will only disable Task Manager for the user running the code and not disable it for everyone who uses the machine.
|
|
|
|
|
I don't think that key exists in HKCU. Use regedit to check.
|
|
|
|
|
Under your Solution in your project name, (Click show all files button above your solution) there is a folder called my project, expand it and open the app.config. Change this line:
<requestedExecutionLevel level="asInvoker" uiAccess="false" /> to one of these:
<requestedExecutionLevel level="requireAdministrator" uiAccess="true" />
<requestedExecutionLevel level="highestAvailable" uiAccess="true" /> You can elevate your application to admin level by using the below code:
.NET
Dim RunAdminMode As ProcessStartInfo = New ProcessStartInfo()
RunAdminMode.UseShellExecute = True
RunAdminMode.WorkingDirectory = Environment.CurrentDirectory
RunAdminMode.FileName = Application.ExecutablePath
RunAdminMode.Verb = "runas"
Try
Dim p As Process = Process.Start(RunAdminMode)
Catch RunAsAdmin As Exception
Return
End Try
C#
ProcessStartInfo RunAdminMode = new ProcessStartInfo();
RunAdminMode.UseShellExecute = true;
RunAdminMode.WorkingDirectory = Environment.CurrentDirectory;
RunAdminMode.FileName = Application.ExecutablePath;
RunAdminMode.Verb = "runas";
try {
Process p = Process.Start(RunAdminMode);
} catch (Exception RunAsAdmin) {
return;
}
Regards,
CodingK
|
|
|
|
|
I would like to learn visual basic - so I bought a book but I don't even know what software to buy to program with. I want to learn how to program for CAD applications but I would like to play and have fun with VB as well. I don't want to spend a bunch of money if I don't have to however if I have to then I will be happy to do so. My problem is that I am brand new and don't know the best way to get started.
I just bought the book: Beginning Visual Basic 2012 by Bryan Newsome.
Any advice would be greatly appreciated.
Thanks!!
Kaz
|
|
|
|
|
|
|
Get a copy of Visual Studio Express from Microsoft[^]. It's free and provides everything you need to get started. There are also hundreds of articles here on CodeProject, and in the wider community that will help you.
|
|
|
|
|
Thank you sir for your response and great suggestion - I appreciate your time!
|
|
|
|
|
If you are just starting out consider learning c# instead of VB, the reason, there are dramatically more examples and support resources for c# than there is for VB.net, unless of course your CAD application uses VB for it's scripting language.
And you still need visual studio express.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thank you sir for your response. I took a class in C 20 years ago and still have a bit of it in the back of my mind. My only problem is the CAD scripting is in VBA so I would like to learn VB if possible. Thank you for your Visual Studio Express suggestion.
|
|
|
|
|
Be a little careful that you are working with the correct platform, VBA is very different from VB.net. I would check if the CAD is using the old VBA, based on VB6 or VSTO which will be using VB.net.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thank you for your response. - CATIA is the CAD system I use - from my understanding it uses VBscript VBA and CATscript. I figure learning any VB type code will give me better skills when I go into the VBA scripting even though it is different.
Thanks
|
|
|
|
|
I would like to add everytime I mention VBA to my programing friends they all make wrinkled faces and shake their head - I realize it is a dead language but CATIA is very much alive and used by the vast majority of the aerospace biz. Thanks for your suggestions
Kaz
|
|
|
|
|
I have the following code where I am updating a new field to a Table. I tried using the NULL in my statement and it does create the field but the Allow Zero length is still false in the table.
Can anyone show me the errors of my ways?
Dim sql As String
Dim connection As OleDbConnection
Dim connetionString As String
connetionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & PathCMDB() & "';"
connection = New OleDbConnection(connetionString)
connection.Open()
Dim cmd As OleDbCommand = New OleDbCommand(sql, connection)
cmd.CommandText = "ALTER TABLE [Machines] ADD [CNC_Folder] Text (255) NULL"
cmd.ExecuteNonQuery()
connection.Close()
connection.Dispose()
|
|
|
|
|
|
Hmm not really I am not using ADOX. I was hoping to just change the sql statement somehow. I am just using standard OleDbConnection
|
|
|
|
|
By the looks of it, it can't be done via a SQL script. If you set the column to "NOT NULL" rather than "NULL", that should allow zero-length values. Will that be feasible, or do you absolutely have to allow both NULL and zero-length?
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
I have to allow both.
"So simply but yet so hard"
I guess I could always create a ADOX wrapper but I don't really want to go that way
|
|
|
|
|
May be your only option. Google it. I searched around and everything I found said that it's not possible via a SQL query script to allow NULL and zero-length.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
Yeah I found the same thing when I Google it. I was hoping there was some bckdoor found by some of the GURU's here.
Thanks for you help though.
|
|
|
|
|
"Trigger".
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Trigger? Not sure what that means
|
|
|
|
|
You could write a trigger to do the validation. Not sure, but might also be done with a constraint that validates the length.
--edit;
I don't think that Access would allow the constraint-construction, I was thinking in Sql Server again. Still, Access does support triggers[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|