|
It appears that your users don't have access ot the root of the system drive (C , not surprisingly. Also, normal users do not have any wirte access to anything under HKEY_LOCAL_MACHINE in the registry. You're going to have to rewrite your code so that data is placed in more appropriate places in both the file system and the registry, depending on your apps requirements.
|
|
|
|
|
hai dave
this time i changed the code ,
instead of "C" drive , i given "D" drive
and for "HKEY_LOCAL_MACHINE", i took "Hkey_Current_User"
but the same error is giving "Access to the path 'D:/mydatapath.txt' is denied"
cant we give permissions to user at runtime.
can dotnet frame works CAS security can do any thing for this ....
wt to do ..
plz help me...
thanks in advance
vijay
devulapally_vijay@yahoo.co.in
|
|
|
|
|
vijaylumar wrote: but the same error is giving "Access to the path 'D:/mydatapath.txt' is denied"
This is because the user does not have permissions to the root directories of the hard disks. If the data is user specific, use the users profile path (Documents and Settings\userid) in the Application Data folder. Read this[^]
vijaylumar wrote: cant we give permissions to user at runtime.
No, because the code is running AS the user. A user cannot grant themselves more permissions that they already have.
vijaylumar wrote: can dotnet frame works CAS security can do any thing for this ....
No, because it has nothing to do with NTFS security and, again, the user cannot grant themselves more permissions than they already have.
|
|
|
|
|
hai friends
i m new to this forum
this is my first question....
i hope u people send the solution..
so that ican continue the forum in future....
my problem is ...
i my PC , i have 2 users 1)administrator 2)myuser
i developed a project,in which i will create a text file at run time and write to it some data.it is working fine in administrator but it is not working in "myuser" account.
the error msg is "access to read/write is denied"
plz solve my problem.....
wt ever it may be the settings .. plz give in detail with code in vb.net 2.0 only or as ur like..
thanks in advance
vijay
devulapally_vijay@yahoomail.co.in
vijay
|
|
|
|
|
What's the full path to file file your trying to write?? There are certain sections (subdirectories) of the file system that normal users cannot write to, so your code should not be attempting to write to files in these sections.
Keep in mind that any code you launch impersonates you, inheriting your security context. In other words, if your user ID doesn't give you permissions to write a file to a directory, any application you launch won't magically get those permissions.
|
|
|
|
|
I had a simple report containing all data in "details". I need to move some fields from the "details" and have them appear in the "page footer". Simple....
I moved them. Now I have about 1/2-inch of white space between the details and the page footer.
I've already done all the "suppress" checkbox on all unused sections, and I've shrunken the size in the designer of all unused sections. There has to be a setting somewhere that is telling Crystal to render 1/2-inch worth of white space between the details and page footer sections, but I just can't find it!
Thanks,
sindhu
Dont Get Paid for the Hours you worked, Get Paid for the Work You Have Done in an Hour.
|
|
|
|
|
Hi all,
I have a image that is converted into a hex string (note see below). I would like to convert this hex string back into the image. How can I start with this? Can someone point me out in accomplishing this?
Thank you very much.
Here under you can find 'a part of' the hex string.
FFD8FFE000104A46494600010100000100010000FFFE002A496E74...
Edit, i removed the biggest part of the hex string because i doesn't look right in this forum. But you can get an idea how it looks like.
|
|
|
|
|
I think i have found it. Searching hard and trying end up with nothing, asking help and the answers suddenly comes.
O well, here i'll give you the solution. (Remind that the hex value is just a part of whole string)
<br />
Private Sub ConvertImg()<br />
Dim hexvalue As String = "FFD8FFE000104A46494600010101000100010000..."<br />
Dim bytevalue As Byte() = HexToBin(hexvalue)<br />
Dim myFileStream As FileStream<br />
Dim intByte As Integer = 0<br />
Dim lngLoop As Long<br />
<br />
Try<br />
intByte = bytevalue.Length<br />
myFileStream = File.OpenWrite("c:\image.jpg")<br />
<br />
For lngLoop = 0 To intByte - 1<br />
myFileStream.WriteByte(bytevalue(lngLoop))<br />
Next<br />
<br />
myFileStream.Close()<br />
Catch ex As IOException<br />
MessageBox.Show(ex.Message)<br />
End Try<br />
End Sub<br />
<br />
<br />
'---------------------------------------------------------------------------<br />
'<br />
' Function: HexToBin()<br />
' Input: s<br />
' Return: bytes<br />
' Purpose: Converts Hex to binary<br />
' <br />
'---------------------------------------------------------------------------<br />
Public Shared Function HexToBin(ByVal s As String) As Byte()<br />
Dim arraySize As Integer = CInt(s.Length / 2)<br />
Dim bytes(arraySize - 1) As Byte<br />
Dim counter As Integer<br />
For i As Integer = 0 To s.Length - 1 Step 2<br />
Dim hexValue As String = s.Substring(i, 2)<br />
<br />
' Tell convert to interpret the string as a 16 bit hex value <br />
Dim intValue As Integer = Convert.ToInt32(hexValue, 16)<br />
' Convert the integer to a byte and store it in the array <br />
bytes(counter) = Convert.ToByte(intValue)<br />
counter += 1<br />
Next<br />
Return bytes<br />
End Function<br />
|
|
|
|
|
Yes, your hex data smells like a JPEG image.
There is no need to write it to disk, you could use a MemoryStream instead.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hi,
Just started vb 2005
I need to load items from an 2 dim array in a listbox, then select items in to another listbox , put the selected values in an array and calculate the totals and display it in a txtbox. If I delete an item in de 2° listbox this should also be re calculated.
This is what i have so far .
The result should be something like :
1 pincet 3 $
3 mascara 12 $
youre total amount is 15 $
Public Class Form1
Dim aThings(3, 1) As String
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Load
aThings(0, 0) = "Mascara 4$"
aThings(0, 1) = 4
aThings(1, 0) = "Lipstick 5 $"
aThings(1, 1) = 5
aThings(2, 0) = "Nivea 3 $"
aThings(2, 1) = 2
aThings(3, 0) = "Pincet 3 $"
aThings(3, 1) = 3
For i As Integer = 0 To 3
LstThings.Items.Add(aThings(i, 0))
Next
End Sub
Private Sub BtnAdd_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles BtnAdd.Click
LstSelecThings.Items.Add(LstThings.SelectedItem.ToString)
End Sub
Private Sub BtnRemove_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles BtnRemove.Click
LstSelecThings.Items.Remove(LstSelecThings.SelectedItem)
End Sub
End Class
|
|
|
|
|
Hi,
rather than adding string to LstSelecThings, you'd better add aThings items to it.
You then could create a calculate() method that iterates over all its items and
sums their value.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
ok , i'll try.
Pattyn.....Belgian ??
|
|
|
|
|
100%
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
|
ik ook (*)
(*) so am I
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
hi all
i am new to .net
m using vb.net 2005
Dim cn As New SqlConnection("Server=;uid=sa;pwd=;Database=")
Dim da As New SqlDataAdapter("select Lognumm,Requestdate,Hospital from Table3 where Hospital= '" & DropDownList1.SelectedItem.Text & "' and Flag=1", cn)
Dim dt As New DataTable
da.Fill(dt)
da.Dispose()
cn.Dispose()
Me.DataGrid1.DataSource = dt
Me.DataGrid1.DataBind()
the above code is for asp.net web apllication using vb.net...now how to do i convert it to vb.net windows application.
i mean what kind of code do i need to write in windows application..
Tanya...(urs_forever_tanya@yahoo.co.in)
|
|
|
|
|
try this
Dim cn as new SqlConnection(.......)<br />
dim da as new SqlDataAdapter(......)<br />
DropDownList.SelectedItem.text & " And Flag=1",cn)<br />
Dim dt as new Datatable<br />
da.Fill(dt)<br />
'No more Dispose, remember automatic garbage collection<br />
Datagrid1.DataSource = dt <br />
remember when you use a datatable, and binding it to a datagrid, you can only use the DataSource Property.
this will do
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Hi All,
I am using the following code to convert the MSflexgrid content to Excel.
This code is also working fine. It opens MS Excel and paste the contents of MSFlexgrid.
But now for me, when i click the button it should ask Open, Save (or)Cancel kind of dialog box, and if press Save it should show Save dialog box and give filename and save it, or if we Give open it should open the excel sheet.
Please help me how to do that.
Code:
Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook
Set xlApp = New Excel.Application
Set xlWB = xlApp.Workbooks.Add
Clipboard.Clear 'Clear the Clipboard
With MSFlexGrid1 'Select Full Contents (You could also select partial content)
.Col = 0 'From first column
.Row = 0 'From first Row (header)
.ColSel = .Cols - 1 'Select all columns
.RowSel = .Rows - 1 'Select all rows
Clipboard.SetText .Clip 'Send to Clipboard
End With
With xlApp.ActiveWorkbook.ActiveSheet
.Range("C2").Select 'Select Cell A1 (will paste from here, to different cells)
.Paste 'Paste clipboard contents
End With ' This makes Excel visible
xlApp.Visible = True
Thanks in Advance,
Regards
|
|
|
|
|
aaraaayen wrote: and if press Save it should show Save dialog box and give filename and save it, or if we Give open it should open the excel sheet.
Then save the data to a temporary .xls file in the %TEMP% folder and launch this .xls file so Excel launches and opens the file itself.
|
|
|
|
|
hi
I created a web service to allow my client program to talk to my website
There is a log in, on my client and website which uses the same username and password.
How would i pass data from my client to the webpage but specific to the user that logged in on the client ..
thanks
|
|
|
|
|
Web Services inherantly do not maintain any sort of state between calls, so you have to provide some method of doing so yourself. Some examples and articles on this can be found by Googling for ".net web service maintain session state[^]".
|
|
|
|
|
Can someone help me with an If statement? I have one Excel sheet with gobs of data and several sheets thereafter with pivot tables. My code will eventually sequence through the various sheets and update the PivotTables. I can't figure out the command to determine if the sheet contains (and ultimately select a cell in) a PivotTable.
TIA,
Bomb_Shell (noob)
|
|
|
|
|
AFAIK, Pivot tables are auto generated based on the data you selected for pivot in Excel. So, why are you changing the Pivot? Instead change the source data, Pivot table will automatically update itself.
"hi, I am explorer.exe. sometimes when you are doing anything at all, I will just freeze for ten minutes. All of my brother and sister windows will also freeze, because they are sad for me. Maybe we will come back, maybe not, it will be a surprise!"
|
|
|
|
|
|
That kind of helps. I was looking more for something like:
If
the active sheet has a pivot table <-- this is the part I'm stumped on.
Then
PivotCache.Refresh
Bomb_Shell (noob)
|
|
|
|