|
RegistryPermission
can someone describe me how this class wokrs for giving permission to registry paths? for example i gave Read Access Permission to HKEY_Currentuser\Myapp (MyApp is a personal key) . and then wrote a code like below:
my.computer.registry.setvalue(...
but still i have all access permission to this path.
i ran this code from same and different assembly but both can change the variables values in that path. what is the solution to set permissions for specific paths in registry during runnig an application?
|
|
|
|
|
I think you're misunderstanding what the RegistryPermission class does. It does not control access to the Registry key, but is a Permission that your code aquires so it can access the registry.
For example, about the best I can explain it is if your code was running from a network share, it wouldn't normally have Permission to Read/Write the registry. The use of this class by your code "asks" the CLR for permission to access the specified registry key. If Code Access Security is setup properly, your code can get the requested permission, if available to it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello,
Almost all of my .NET coding has been ASP.NET so I haven't used a timer control much at all. Now I'm coding an application in which I have implemented a timer control that ticks every 1 second. It goes something like this:
Timer.tick fires
if it is the top of the hour,
do some stuff that takes 30 seconds or so
end if
My question is, what happens to the timer ticks while it does "some stuff for 30 seconds or so" ?
"Half this game is ninety percent mental." - Yogi Berra
If you can read thank a teacher, if you can read in English, thank a Marine.
M y and h don't work so well due to m addiction to caffeine and m in abilit to to set a cup down uprigt.
|
|
|
|
|
The Timer keeps running, piling up 30 seconds worth of Tick events!
In your Tick event handler, just disable the timer. Then at the end of the handler, re-enable it.
Private Sub Tiemr1_Tick(blah, blah) Handles Timer1.Tick
Timer1.Enabled = False
.
. do your processing here...
.
Timer1.Enabled = True
End Sub
Dave Kreskowiak
Microsoft MVP - Visual Basic
-- modified at 18:19 Monday 17th July, 2006
|
|
|
|
|
Thanks Dave, it makes sense to disable the timer while I'm doing work. Here is what I've got:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Now.TimeOfDay.Minutes = 0 Then
'Do work that takes 30 seconds
End If
End If
The work only happens twice since it takes 30 seconds. So the ticks sort of build up while I'm doing work and then flood on through after the work is done I suppose. Otherwise the work would run 60 times in the minute at the top of the hour, correct? Now.TimeOfDay.Minutes only gets evaluated later on (after work is done) it seems, and not when the tick actually occurs. That is what it seems like.
At any rate, I will my code change to:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Now.TimeOfDay.Minutes = 0 Then
Timer1.Enabled = False
'Do work that takes 30 seconds
Timer1.Enabled = True
End If
End If
"Half this game is ninety percent mental." - Yogi Berra
If you can read thank a teacher, if you can read in English, thank a Marine.
M y and h don't work so well due to m addiction to caffeine and m in abilit to to set a cup down uprigt.
|
|
|
|
|
Hello!
It is an asp access based web site. The entries in the asp pages have entered in Turkish and there is no problem displaying the turkish characters in asp pages. However, when I record the entry in to access database file and then re-open the file, I have seen different ascII characters instead of Turkish characters. I have hosted the web site in the states. Can localization cause such problem by the server?
Is there a way to see exact turkish characters in the access database file.
Thank You
|
|
|
|
|
okay, I'm a baby programmer, so don't laugh if this question is too obvious, but I've been stuck on this for hours now
Very simple assignment - select data from an access data base
using a data adapter and use the fill method to populate a data set
I've looked at several examples that I've found on line and don't see what's wrong with my code. I always get a message on the adapter.fill line saying 'no value passed for one or more parameters'
I see examples that dont just say adapter.fill(datasetname)
and others that others that give a name for the name for the results within the data set, but I can't get either of these to work
heres the latest attempt
Thanks
Protected Const CANDIDATESRESULTS As String = "Results"
Protected connection As OleDbConnection = New OleDbConnection(connectionString)
Public Sub OneCandidate(ByVal CandID As String)
Dim candidateInfo As String = "SELECT * FROM CandidatesResults where CandidatesReulsts.CandidateID = '" & CandID & "'"
Dim candAdapter As OleDbDataAdapter = New OleDbDataAdapter(candidateInfo, connection)
candAdapter.SelectCommand = New OleDbCommand(candidateInfo, connection)
candAdapter.Fill(candData, CANDIDATESRESULTS)
DG.DataSource = candData
DG.DataBind()
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=..\..\SampleDataBase.notadb"
Dim candData As DataSet = New DataSet
|
|
|
|
|
Your code is a little out of order... You are dim'ing your connection string and your dataset after you've already connected to the database and attempted to fill your dataset. Try this:
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=..\..\SampleDataBase.notadb"
Dim candData As DataSet = New DataSet
Dim con As OleDbConnection = New OleDbConnection(connectionString)
Public Sub OneCandidate(ByVal CandID As String)
Dim candidateInfo As String = "SELECT * FROM CandidatesResults where CandidatesResults.CandidateID = '" & CandID & "'"
Dim candAdapter As OleDbDataAdapter = New OleDbDataAdapter(candidateInfo, con)
candAdapter.Fill(candData, CANDIDATESRESULTS)
DG.DataSource = candData
DG.DataBind()
-- modified at 15:09 Monday 17th July, 2006
|
|
|
|
|
thanks
I can get this code to 'work' meaning not blowing up by dim the datagrid
(Dim CandDG As DataGrid = New DataGrid) inside the class that contains this public sub
the problem is the assignment calls for me to pass the data from the class to a form that calls the class. I haven't been able to get that to work
|
|
|
|
|
To pass the dataset from the class to the form you will need to modify the parameters of your method. Instead of just passing the ID string, you will also need to pass the dataset. But you will have to pass it by reference instead of by value. (passing by value will never change the original variable on the form side, by reference will)
So it will look more like this:
Public Sub MyMethodName(ByVal myID as String, ByRef myDataSet as DataSet)
That should get you started.
|
|
|
|
|
hi i m reading images from the databse and showing on picbox,so i had to make the temporary file to show pic on the picturebox thorugh Pic.image=Image.fromfile etc. it works fine.
i want to make one file for that purpose and delete when new file is readed from databse.
i m using this code for that purpose
Pic.image=null;
if(File.Exist("temp.bmp"))
File.Delete("temp.bmp");//give exception file used by process
String newf="temp.bmp"; and save the new data from database to this file and show it to the user.
but it give the exception that file is used by another process,i had clear the picbox but still gives.
how to do that Thanks in advance.
Tasleem Arif
|
|
|
|
|
|
Hi,
I faced one problam to show data in DataGrid.
I want to display one column as Top and remaining 4 columns as bottom.
like
AndhraPradesh
Hyderabad 23 23 23
Vizag 23 23 23
Karnataka
Banglore 23 23 23
Mangalor 45 45 45
TamilNadu
Chennai 23 23 23
Coimbatore 57 56 45
Please Give me solution
Thanks
Madaka
Madaka
|
|
|
|
|
Hy! I'm sorry if i can't explain my problem very well, i'm italian but i need help for a problem with vb.net program... so...
I make a web service that extract some value from a db and this result must be insered in this public structure:
<br />
Public Structure SERVS1Result<br />
Public NumeroComm As Integer<br />
Public Comm As SComm<br />
<br />
Public Structure SComm<br />
Public Nome As String<br />
Public Indirizzo As String<br />
Public Cap As String<br />
Public Comune As String<br />
Public SiglaProvincia As String<br />
Public Email As String<br />
Public telefono As String<br />
End Structure<br />
End Structure<br />
the result that i must receive for 2 record extract, is this for examp:
<soap:envelope xmlns:xsi="
"http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd="
"http://www.w3.org/2001/XMLSchema"" xmlns:soap="
"http://schemas.xmlsoap.org/soap/envelope/"">
<soap:body>
<servs1response xmlns="http://www.contoso.com/Response">
<servs1result>
<numerocomm>int
<comm>
<scomm>
<nome>string
<indirizzo>string
<cap>string
<comune>string
<siglaprovincia>string
<email>string
<telefono>string
<scomm>
<nome>string
<indirizzo>string
<cap>string
<comune>string
<siglaprovincia>string
<email>string
<telefono>string
I wrote this code:
<br />
Public Function SERVSUPP001(ByVal ist As String) As SERVS1Result()<br />
<br />
.........code..........<br />
<br />
If Not risolvi = "" Then<br />
objConn.Open()<br />
<br />
Dim Com() As SERVS1Result 'Giusto<br />
<br />
Dim pec As String<br />
Dim i As Integer = 0<br />
Dim x As Integer = 0<br />
Dim c As Integer<br />
Dim objCmd2 As New OleDbCommand("ConnectionString", objConn)<br />
Dim objReader2 As OleDbDataReader<br />
objReader2 = objCmd2.ExecuteReader<br />
<br />
While objReader2.Read<br />
pec = (objReader2.GetString(9))<br />
If pec = "Y" Then<br />
ReDim Preserve Com(i)<br />
<br />
Com(i).Comm.Nome = objReader2.GetString(2) 'Sede<br />
Com(i).Comm.Indirizzo = objReader2.GetString(4) 'indirizzo<br />
Com(i).Comm.telefono = objReader2.GetString(5) 'telefono<br />
Com(i).Comm.Email = objReader2.GetString(8) 'email<br />
Com(i).Comm.Cap = CapCom<br />
Com(i).Comm.Comune = Comune<br />
Com(i).Comm.SiglaProvincia = Provincia<br />
i = i + 1<br />
End If<br />
<br />
End While<br />
<br />
objConn.Close()<br />
objConn.Dispose()<br />
<br />
<br />
Return Com<br />
<br />
End If<br />
<br />
<br />
End Function<br />
but my result is that all the structure is replicate for each record and i need only to replicate the second structure in the first structure, this:
<br />
Public Structure SComm<br />
Public Nome As String<br />
Public Indirizzo As String<br />
Public Cap As String<br />
Public Comune As String<br />
Public SiglaProvincia As String<br />
Public Email As String<br />
Public telefono As String<br />
End Structure<br />
Can you help me please?
-- modified at 9:29 Monday 17th July, 2006
|
|
|
|
|
Hi!
Can anybody guide me how to set a vb application run as a service in windows XP?
Thanks!
|
|
|
|
|
Assuming you have the source code, two options off the top of my head.
1. If this is VB 6, you can use the 'Microsoft NT Service Control' (ntsvc.ocx); search the web for it and documentation on how to use it.
2. If this is a VB.Net application, write it is a service.
|
|
|
|
|
I'm writing a simple tool to take backup of folders in a LAN. THe problem is, many clients on the network use multi-language Windows OS. So I'm not able to read folders written in, say, chinese language. On server the folder is shown as "??????" and so when I try to access that folder in the path, it shows "path not found" error. Any help to solve this problem would be highly appreciated.
|
|
|
|
|
I am writing a Javascript (AJAX) to hit a server side code.
The Server side code is called when the Javascript is executed for the first time and the readystate is 1.
But when I am trying to hit it again, the server side code is not hit and the ready state is shown as 4.
I'm trying to hit the server side code everytime the AJAX code is executed.
Please find the code below:
function confirmExit() {
var request = false;
var uri = "test1.aspx";
alert("State:" + request.readystate);
if (window.ActiveXObject) // for IE
{
request = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) // for other browsers
{
request = new XMLHttpRequest();
}
request.open("GET",uri, true);
request.send(null);
}
Vikas
|
|
|
|
|
hi i had treeview which is filled form databse.when i add new item and update the treeview(refill it) then it collapses,can i get its previous position and reopen it at that pt where it was /or prevent it from collapsing. Thank in advance
Tasleem Arif
|
|
|
|
|
Hi there.
Just make a tempory vairable of the selected node in the treeview and after reload it from the database set the treeview's selected node to the tempory node.
Example:
Dim tempNode as TreeNode
tempNode = trView.SelectedNode
'''Reload from database
trView.SelectedNode = tempNode
trView.SelectedNode.EnsureVisible
A programmer's life is good... or is it?? Ek dink nie so nie!
|
|
|
|
|
i had used that code in the after select event of treeview and it give the exception below.
object refrence not set to the instance of object
which i caught in try catch block
Tasleem Arif
-- modified at 2:56 Tuesday 18th July, 2006
|
|
|
|
|
Are you sure you used the right namespace for your treeview? trView represent the treeview’s name you use. This code I gave you should work, I’m using it myself.
A programmer's life is good... or is it?? Ek dink nie so nie!
|
|
|
|
|
Dear all,
I have a large database in Access and I want to convert it to an Excel file with many sheets using VB6. But I do not know how to do it.;P
Please tell me!
Thank you very much!
Chau Nguyen
|
|
|
|
|
What do you mean by "large Access database"? How many records??
Excel is grossly inefficient at storing large amounts of data. Each sheet can only hold just over 65,500 rows. Excel can easily run the machine out of RAM long before you get to "many sheets".
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have over 72 thousands records. So I really need convert database to Excel file having many sheets.
|
|
|
|