|
Help with what?? You haven't asked a question yet.
Boot.ini (which is now deprecated under Vista and Windows 7) is just a text file. Read it, parse it up, modify the parsed data, write it back out. Oh, you have to strip off the ReadOnly attribute of the file first.
The registry change is easy too. See the Registry class.
And rebooting Windows is just a matter of calling the Win32 API function ExitWindowsEx.
|
|
|
|
|
I have a pop-up window that gets displayed after a button has been evoked on the parent window.
The pop window contains an img with text that conveys to the user that the current file is downloading and an iframe.
The iframe does the bulk of the work ... it populates a infrigistics grid that inturn populates an xls document that gets compressed ... and so forth ... however the problem arises when one wants to navigate to another page from the parent page... it takes long to load another page.
It's very confusing what is the link beween a popup window and it's parent
|
|
|
|
|
So this has nothing to do with Visual Basic? If so, ask it in the ASP.NET forum, please.
|
|
|
|
|
hmm ... does it not say VB.NET what does that mean sorry i'm new here
|
|
|
|
|
It sounds like you're making a webpage, right? You'll get better help with that stuff in the ASP.NET forum.
|
|
|
|
|
Thanks i have posted there as well..... thanks though
|
|
|
|
|
Hi Guys..
I'm just new in programming with registry key..
my problem is if the user is log as a limited user (LOCAL USER)
i just encounter a error about registry permission
can you help me about this..
this is my code:
Dim Xuser As String = Environment.UserDomainName _
& "\" & Environment.UserName
Dim rule As New RegistryAccessRule(Xuser, _
RegistryRights.WriteKey, _
AccessControlType.Allow, _
PropagationFlags.None, _
AccessControlType.Allow)
rootkey.GetAccessControl.SetAccessRule(rule)
rootkey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run")
rootkey.DeleteValue("bitz")
thanks.. hopefully you guys can help me.
Bitz
|
|
|
|
|
Just about the entire HKEY_LOCAL_MACHINE hive is read only to non-admins. Users cannot grant themselves more permissions than they already have.
You have no choice but to run this app as an adminstrator. As an admin, granting users write permissions to the Run key is asking for trouble.
|
|
|
|
|
is there other way..???
coz the program need to run in user group logon
your help is badly needed..
thanks..
Bitz
|
|
|
|
|
Then this registry value must be set by an Administrator. Users will not be able to do this. Something like this is normally done by the application's installer, which is always run by an Admin.
|
|
|
|
|
Dave Kreskowiak wrote: Something like this is normally done by the application's installer, which is always run by an Admin.
For very good reason, too.
"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
|
|
|
|
|
U can try this may be it will work. Run program in local user use operation "Run as" may be it wil work
|
|
|
|
|
non-bugging Errors wrote: Run program in local user use operation "Run as" may be it wil work
Quote Selected Text
As Dave mentioned, this can potentially ask for trouble doing so.
"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
|
|
|
|
|
I have a DGV w/20 columns (4 hidden). The default column sort works fine except for one column which I would like to sort based on the value of a hidden column.
Primitive Example:
Column 5 = Cost (String)(visible)
"1 Apple"
"1 Apple, 2 Oranges"
"2 Oranges"
Column 20 = TotalCost (Integer)(hidden)
1
3
2
When the user clicks on the column for sorting I should display:
"1 Apple"
"2 Oranges"
"1 Apple, 2 Oranges"
Question: How do I intercept the sort event for a specific column and use a different field to sort the results?
|
|
|
|
|
Intercepting the event - oncolumnclick
Detecting the column clicked - e.index I think
custom sorting - you will probably need to write your own, I'd be surprised if there is not an article here already.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks for the reply. I Implemented the following to solve it (using the fruit example):
<br />
Private Sub SortButton_Click(ByVal sender As Object, _<br />
ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGridView1.MouseClick<br />
<br />
Dim hit As DataGridView.HitTestInfo = DataGridView1.HitTest(e.X, e.Y)<br />
If hit.Type = DataGridViewHitTestType.ColumnHeader Then<br />
If DataGridView1.Columns.Item(hit.ColumnIndex).Name = "Fruit" Then<br />
<br />
Dim oldColumn As DataGridViewColumn = DataGridView1.SortedColumn<br />
Dim newColumn As DataGridViewColumn = DataGridView1.Columns.Item("FruitCount")<br />
Dim direction As ListSortDirection<br />
<br />
' If oldColumn is null, then the DataGridView is not currently sorted. <br />
If oldColumn Is Nothing Then<br />
direction = ListSortDirection.Ascending<br />
Else<br />
' Sort FruitCount again, reversing the SortOrder.<br />
If Me.DataGridView1.SortOrder = SortOrder.Ascending Then<br />
direction = ListSortDirection.Descending<br />
Else<br />
direction = ListSortDirection.Ascending<br />
End If<br />
End If<br />
<br />
' Sort the grid based on FruitCount<br />
Me.DataGridView1.Sort(DataGridView1.Columns("FruitCount"), direction)<br />
DataGridView1.Columns("Fruit").HeaderCell.SortGlyphDirection = direction + 1 <br />
Else<br />
DataGridView1.Columns("Fruit").HeaderCell.SortGlyphDirection = SortOrder.None<br />
End If<br />
End If<br />
<br />
End Sub<br />
The other columns have autosort, so if the column I'm looking for is not selected (or any other random click) it just falls through to the default handlers. Also using column name instead of index since I allow the user to move (some) columns.
|
|
|
|
|
I would have thought you would use columnheadermouseclick as the initiating event?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Actually I did try that but I could never get e.ColumnIndex to return anything other than -1 although the event fired properly. Probably mis-coded it or maybe since I have fullrowselect on?
|
|
|
|
|
Hi everyone,
a problem with "{" character iun VB
Example
Dim sb As Text.StringBuilder = New Text.StringBuilder()
sb.AppendFormat("click(function()")
sb.AppendFormat("{") 'exception in this line
sb.AppendFormat("}") 'the same exception for this line
Console.WriteLine(sb.ToString())
exception {"Input string was not in a correct format."}
how can I correct it in VB
|
|
|
|
|
You didn't supply a Format specification to the AppendFormat method.
Since it's obvious that you're not out to format data when you put it in a string, change those AppendFormat methods to just Append .
Try reading the documentation on the StringBuilder class.
|
|
|
|
|
since { is a "special" character when it comes to formatting, the error you got is once for the fact that u didn`t supply a valid format and second because u didn`t supply any of the objects that need to be formatted. A minimum code change should be
sb.AppendFormat("{0:G}","}")
|
|
|
|
|
I'm writing a util that uses a hidden webbrowser control to traverse through a few .aspx pages. These are through an SSL enabled site. I want to accept the certificate and or install it locally instead of the end user clicking on "yes" to accept it. I've googled for quite some time and found 2 different methods. One for .NET 1.1 and .NET 2.0. I cannot get either to work. The dialog still pops up. I am trying to put this into a module. Here's what I have tried.
Imports System.Net
Imports System.Net.Security
Imports System.Security.Cryptography.X509Certificates
Imports System.Security.Policy
Module VWeb
Dim WithEvents WB As New WebBrowser
Dim ASPComplete As Integer = 0
Dim LoginURI As New Uri("https://XXX.com/Login.aspx")
Dim OpenCallsURI As New Uri("https://XXX.com/openCallReport.aspx")
Dim MainPage As New Uri("https://XXX.com/Default.aspx")
Dim TestTimer As New Timer()
Public Function LoginAsTech(ByVal UserID As String, ByVal Pass As String) As Boolean
Dim MyDoc As New mshtml.HTMLDocument
Dim DocElements As mshtml.IHTMLElementCollection = Nothing
Dim LoginForm As mshtml.HTMLFormElement = Nothing
ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf ValidateCertificate)
ASPComplete = 0
WB.Navigate(LoginURI)
BrowserLoop()
MyDoc = WB.Document.DomDocument
DocElements = MyDoc.getElementsByTagName("input")
For Each i As mshtml.IHTMLElement In DocElements
Select Case i.name
Case "seLogin$UserName"
i.value = UserID
Case "seLogin$Password"
i.value = Pass
Case Else
Exit Select
End Select
frmServiceCalls.txtOut.Text &= i.name & " : " & i.value & " : " & i.type & vbCrLf
Next i
'WB.Document.Forms("form1").InvokeMember("submit")
LoginForm = MyDoc.forms.item("form1")
LoginForm.item("seLogin$LoginButton").click()
ASPComplete = 0
BrowserLoop()
MyDoc = WB.Document.DomDocument
DocElements = MyDoc.getElementsByTagName("input")
For Each j As mshtml.IHTMLElement In DocElements
frmServiceCalls.txtOut.Text &= j.name & " : " & j.value & " : " & j.type & vbCrLf
Next j
frmServiceCalls.txtOut.Text &= vbCrLf & vbCrLf & WB.Url.AbsoluteUri & vbCrLf
Return 1
End Function
Public Sub BrowserLoop()
Do Until ASPComplete = 1
Application.DoEvents()
Loop
End Sub
Private Sub WB_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WB.DocumentCompleted
ASPComplete = 1
frmMain.tsProgress.Visible = False
frmMain.lblProgress.Text = ""
End Sub
Private Sub WB_Navigating(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles WB.Navigating
frmMain.tsProgress.Visible = True
frmMain.lblProgress.Text = "Navagating"
End Sub
Public Sub WB_ProgressChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) Handles WB.ProgressChanged
frmMain.tsProgress.Maximum = Convert.ToInt32(e.MaximumProgress)
frmMain.tsProgress.Value = Convert.ToInt32(e.CurrentProgress)
End Sub
Public Function ValidateCertificate(ByVal sender As Object, ByVal certificate As X509Certificate, ByVal chain As X509Chain, ByVal sslPolicyErrors As Security.SslPolicyErrors) As Boolean
'Return True to force the certificate to be accepted.
Return True
End Function
End Module
Method 1 - This method is for the .NET 1.1 framework. I'm using 2.0. Tried it anyways with no luck.
frmMain_Load Event()
ServicePointManager.ServerCertificateValidationCallback = New CertPolicyOverride
Imports System.Net
Imports System.Security.Cryptography.X509Certificates
Public Class CertPolicyOverride
Implements ICertificatePolicy
Public Function CheckValidationResult(ByVal srvPoint As ServicePoint, ByVal cert As X509Certificate, ByVal request As WebRequest, _
ByVal certificateProblem As Integer) As Boolean Implements ICertificatePolicy.CheckValidationResult
'Return True to force the certificate to be accepted.
Return True
End Function
End Class
Method 2 - Tried putting ServicePointManager line in the frmMain_Load event, didn't work. Tried in the module before "navigating" call. Tested the same. I also tried ValidateCertificate in both frmMain and in the module as well.
ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf ValidateCertificate)
Public Function ValidateCertificate(ByVal sender As Object, ByVal certificate As X509Certificate, ByVal chain As X509Chain, ByVal sslPolicyErrors As Security.SslPolicyErrors) As Boolean
'Return True to force the certificate to be accepted.
Return True
End Function
I've tried a few ways and I've been trying off and on for about 2 weeks. Finally came to the message boards for help. I'm starting to wonder if it has to do with the WebBrowser class. I was trying to stay away from WebRequest and HttpWebRequest. I find it really easy to process these web pages and javascript utilizing the WebBrowser control. I need to click a button or checkbox here and there and I would rather let the WebBrowser handle the background stuff like .aspx/javascript callbacks, realtime combo box updates etc... Things that are processed as you go. Any Takers??
Thank you,
Joe G.
|
|
|
|
|
You still can process the output of webrequest or httpwebrequest with webbrowser control using WebBrowser.DocumentStream property ... so for test purposes make the request with a webrequest and redirect the incoming stream to documentstream property.
Additionally ServicePointManager serves for managed code usage, while webbrowser is a wrapper around the shdocwhatever.
|
|
|
|
|
The answer from sph3rex is an entirely valid one, however if you still want to do it using your hidden window I have a solution that will assist you. It is part of an article detailing various WebBrowser/Security 'tricks' that I have employed that I am currently writing up. It should be published here on Code Project shortly (i.e. in the next week) and I will notify you when it is ready.
BimJeam
|
|
|
|
|
I look forward to it. I'm sure it will help others. I'm experimenting with the DocumentStream property. So far it's been ok. Not getting what I wanted but still tweaking about. Thanks.
|
|
|
|