|
|
I want to have a text file in which one can do copy and paste to only those users to whom i would have given the permission.So i want to disable copy and paste button to restrict from other users. How could I do this in c#
|
|
|
|
|
you could write your own code, get the user information and do stuff accordingly
http://www.csharphelp.com/archives2/archive439.html
or use azman
http://community.bartdesmet.net/blogs/bart/archive/2006/06/29/4112.aspx
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
I have a problem with a windows service i have created. I am using SqlDependency to notify my service of changes in a table in a database. When I compile this in Debug mode everything works fine. However when I compile in Release mode I am getting problems. The service runs fine until the table in the database changes and then the service just hangs. Does anyone have any ideas on why this might be occuring in the release build but not the debug build?
|
|
|
|
|
I've figured out this problem is a result of timing. I have put in some simple for loops just to create delays and the problem has gone away.
Now to implement a better solution.....
|
|
|
|
|
It seems that the download dialog triggered by this code
prevents the label control “Label2” to show its message.
What should I change/add to this code in order that the message
"Download Complete" could appear in the web page in the
“Label2” control ?
Here is the relevant code:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
protected void DownlFile_Click(object sender, EventArgs e)
{
string web_path = "./items/X-103.pdf";
string path = Server.MapPath(web_path);
FileStream MyFileStream = new FileStream(path, FileMode.Open);
long FileSize;
FileSize = MyFileStream.Length;
byte[] Buffer = new byte[(int)FileSize];
MyFileStream.Read(Buffer, 0, (int)MyFileStream.Length);
MyFileStream.Close();
Response.ContentType = "application/pdf";
Response.AddHeader
("content-disposition", "attachment; filename= X-103.pdf");
Response.BinaryWrite(Buffer);
Label2.Text = "Download Complete";
}
<asp:Button ID="DownlFile" runat="server" Text="Download The File"
OnClick="DownlFile_Click" />
<br /> <br />
<asp:Label ID="Label2" runat="server" Text=""></asp:Label>
|
|
|
|
|
You can't do that. Either set the type to a file download ( in which case it will pop up an open/save dialog, or otherwise, you're writing a PDF to your page, in which case, you're showing a PDF, which will replace any HTML, and you shouldn't be generating any. I do a response.End after code like this.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Hello people!
I'm using the function SHGetFileInfo from shell32.dll to get the icon handle for a normal file, but i don't know how to get the ghosted icon for a hidden file.
Anyone knows if there's a way to get the ghosted icon?
Thanks in advance
|
|
|
|
|
Is SFGAO_GHOSTED what you're looking for?
|
|
|
|
|
Well, I use IShellFolder::GetAttributesOf to find out if a file is hidden. The problem is that I don't know if there's an ghosted icon in the system imagelist, or if I have to make the ghosted effect for the icon myself.
|
|
|
|
|
This link might be of some use, the article has vb code but you can download or view online both C#/VB.
|
|
|
|
|
Hi,
Can be an easy one for you.
When I tried to insert a big picture into a small picture box, only a small part of the picture was shown in the box. How can I display the whole picture into the picturebox without changing the box size.
|
|
|
|
|
|
Thank you for the reply. That helped me.
|
|
|
|
|
Hi
I would like to know how I can estimate the total physical memory usage (as well as availability) for the entire system, so I can display the usage figures in my application. Is there a class in the .NET framework I can use? If not, is anybody aware of any libraries I can download that contain such a class?
Furthermore, I would like to be able to invoke the GC and collect garbage from all processes running on the system. Again, I would appreciate it if someone could point me to a class that provides these facilities. I have tried using the GC class, but I can only collect garbage for my own application.
Thanks in advance .
Ray
|
|
|
|
|
You can use WMI to obtain the amount of physical RAM by adding a reference to the System.Management namespace.
You would query the Win32_PhysicalMemory provider.
A quick search on CodeProject showed this article: http://www.codeproject.com/cs/system/GetHardwareInformation.asp
I'm sure that forcing GC on all processes is impossible as not all applications are managed.
I however look forward to reading any other comments.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
Hi,
I am working on a Windows based project in Visual Studio.net.
1) I would like to store some documents (like Word, Excel, PPT) in SQL server 2000 and
2) Then show its shortcut as shown in a desktop in a listview.
3) When we click on that shortcut the file should open.
Can somebody please help me with the above 3 scenarios.
-- modified at 1:43 Monday 2nd April, 2007
|
|
|
|
|
1. http://support.microsoft.com/?kbid=258038
2. http://msdn.microsoft.com/msdnmag/issues/1100/c/
3. look to 1., just reassemble the file and run it.
http://www.codeproject.com/csharp/UseProcess.asp
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
Hello everyone,
I have a Temparary Text file which is created when the user runs the Windows Application. I also would like to delete this file once the user closes the Windows Application.
Can someone be kind enough to tell me where I need to place the code to remove the file?
File.Delete("theTextFile.txt");
Thank you very much for your help and have a great weekend.
Khoramdin
|
|
|
|
|
If it's a Form based application, you can do this by overriding the OnClosing or OnClosed methods and putting the file deletion code there.
|
|
|
|
|
Hello to all!
i am new to c# and we are required to process the text files, minimum size of 35.4 GB. The tasks we want to acheive are
a. Make the file consistent - by removing unwanted 'return' chars
b. Generate the XML file
c. Load the data in XML file to database (MS SQL Server 2005)
the problem we are facing is, the process is taking massive amount of time, i.e. more than 1 hour to process just 500 MB of the file!!
currently we are just going through the file char by char, and checking if it is a data or '/r' or '/n', which definitly is not the best way to read such huge file...
so, we will definitly like to know the possible ways/techniques with which we can reduce the processing time.
the following is the code we are currently using:
while (read_from_file.EndOfStream != true)
{
read_from_file.ReadBlock(readfile, 0, 1);
temp = readfile[0].ToString();
if (!IsAlphaNumeric(temp) && readfile[0] != '-' && readfile[0] != '_')
{
if (temp == " ")
{
if (token == match_word && first_line_check>1)
{
write_to_file.WriteLine();
write_to_file.Write(token);
}
else
{
write_to_file.Write(token);
}
write_to_file.Write(" ");
token = null;
}
else if (readfile[0] == '\n')
{
write_to_file.Write(token);
write_to_file.Write(" ");
token = null;
}
}
else
{
token = token + temp;
}
}
in code, the variable "match_word" is the data before which we require the new line to be started, '/r' and '/n' at any other place are invalid and must be removed.
also, will "threads" and "reading text file in byte instead of char" be helpful and increase the speed of processing? and will the threaded code will be able to keep the data in same sequence??
and how much can we reduce the processing time?
Thanks in advance
Adeel
|
|
|
|
|
madeelch1986 wrote: read_from_file.ReadBlock(readfile, 0, 1);
You read from disk char by char? I think reading larger chunks of data at once should be faster. Then again there is probably some caching in TextReader/stream/disc or so, so experiment a bit and measure performance might be good idea.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Thankyou very much....ya i was thinking of experimenting with threads and reading in bytes rather than in chars....but the 1st experiment did it all....the solution from "Guffa" made the process completed in less than 20 MINUTES on the same 35 GB file!!!!!
|
|
|
|
|
dnh wrote: You read from disk char by char? I think reading larger chunks of data at once should be faster
Actually there is underlying caching.
Anyway, without any doubt, OP's code is by no means optimal.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|