|
Based on what I understand, if I am currently logged in under a user profile that requires a username and password and is part of the Administrators group the following should work; however, when it is run under my profile that is part of Administrators I receive an exception stating that "Request for principle permission failed". Is there something I am missing about the way PrinciplePermissions work? Any help would be appreciated - I'm stumped.
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
try<br />
{<br />
Test(); <br />
}<br />
catch (SecurityException ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
}<br />
}<br />
<br />
[PrincipalPermissionAttribute(SecurityAction.Demand, Role="Administrators")]<br />
private void Test()<br />
{ <br />
}<br />
|
|
|
|
|
|
I've run into an FxCop warning that I'm having a difficult time understanding how to get around it (other than simply supressing the message).
I have a class that implements multiple interfaces. These interfaces are:
public interface IHistoryService
{
bool Supported { get; }
Document Document { get; }
}
public interface IValidationService
{
bool Supported { get; }
ReadOnlyCollection<ValidationError> ValidationErrors { get; }
} Since the interfaces both define bool Supported { get; } , I need to implement them explicitly. It is possible that, given different internal states, the IHistoryService functionality might be supported while the IValidationService functionality isn't (or vice versa).
For the sake of simplicity, here is a much slimmed down version of my implemenation class:
public class DocumentViewer : Form, IHistoryService, IValidationService
{
bool IHistoryService.Supported
{
get
{
return true;
}
}
bool IValidationService.Supported
{
get
{
return true;
}
}
} When I run FxCop against this assembly, I get the following warning:
CA1033 : Microsoft.Design : Make 'DocumentViewer' sealed (a breaking change if this class has previously shipped), implement the method non-explicitly, or implement a new method that exposes the functionality of 'IDocumentInformationService.get_DocumentTemplateFullName():String' and is visible to derived classes. From the description on MSDN, it tells me:Consider a base type that explicitly implements a public interface method. A type that derives from the base type can only access the inherited interface method through a reference to the current instance (this in C#) that is cast to the interface. If the derived type re-implements (explicitly) the inherited interface method, the base implementation is no longer accessible. The call through the current instance reference will invoke the derived implementation; this results in recursion and an eventual stack overflow. So...I know I could implement
public bool Supported
{
get
{
return true;
}
} which would satisfy the warning. The problem here is that this property doesn't make sense on the DocumentViewer , so it would be completely useless (other than to satisfy the warning).
How would I implement this so it satisfies the warning, or is this really even something to worry about?
|
|
|
|
|
How to create the formatting bar at run time as provided in this site for bold,italic and underline
Thnx & Regards
Manoj Bisht
|
|
|
|
|
Don't cross post. One forum will do. And looking at the question - you need to ask it in a different way. It doesn't make sense.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
I have made an budget app, and i will now try to add an PRint Document to my app, whrn clicking the button i wish to printwhat i se in the txtbox that i called lstIems
Rolf T
|
|
|
|
|
Can any one help me with this
I have a Excel sheet,each cell has a textbox on it.i have to put data on to textboxes from C#
i am using this:
Microsoft.Interop.Office.Excel.TextBox txtbox= (Microsoft.Interop.Office.Excel.TextBox)workbook.Texboxes("textbox1");
here textbox1 is the name of the textbox on excel cell[1,1] but i have lot of textboxes on excel i cannot give names by myself,so my question is
How to find out the name of the textbox on a Excel cell from C# using
Microsoft.interop.office.excel libraries.
Thank You
KU
|
|
|
|
|
Hi,
I have used some Jsharp Dlls for zipping and Unzipping files but my problem is i couldn't get those Dlls from the free version of .net FW avaibale in the net,Thts why i coudn't able to zip and unzip wen i am running my application on other systems.Even i have added vjslib to my application bt still getting the following error message
"The type initializer for 'java.lang.system'threw an exception"
can anybody help me how to avoid this exception.
Any help will be appreciated.
|
|
|
|
|
There is something people seem to ignore as much as they can: Visual Studio
does support Java (but calls it J#). There is a VS2005 for it too, as well as
a free Express Edition, so you can download it.
IIRC it does not come with the vjslib.dll file that you need; the file that came
with VS2003 (.NET 1.1) works under VS2005 (.NET 2.0) tho. (I doubt you would be
able to use it in a signed application!)
Google may help you locating such a file;
its destination is C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\vjslib.dll
The alternative is using one of many other ZIP packages, both on CodeProject and
elsewhere.
|
|
|
|
|
Thank you Luc Pattyn
But the problem is even after adding this vjslib.dll file to my application start up folder i am still getting this error mssg
"The type initializer for 'java.lang.system'threw an exception"
could you please tell wat would be the cause for this one?
|
|
|
|
|
I can't tell you more; I don't know what your situation is, I don't know
your app, haven't seen any of its code. Did you install VS J# ? Do you
have any J# code running at all ?
The exception must tell a lot more; did you show it with ToString() ?
it would show a traceback, that points to the offending line,
and some technical details (one or several lines).
If any nested ("inner") exceptions are involved, it would show them too.
|
|
|
|
|
when I read file I use StreamReader and use Readline() to read every line,but I also read key "Enter",I want to skip the key "Enter",what method or class should I use ?
thanks
|
|
|
|
|
Mbe u can use the keyascii method by checking foor keyascii 13
Regards
Bino
|
|
|
|
|
What is it that you are doing, really? There are no keys in a file. Are you reading a file, or are you reading keypresses?
---
single minded; short sighted; long gone;
|
|
|
|
|
I think your problem is to press Enter key until the reading file is over , right ?
If is that your problem , here is an solution , something like following code :
while (stream.Read())
{
// TO DO : Reading file
}
DMASTER
|
|
|
|
|
I don't have the problem. You should reply to the original poster, not to one of the replies. Otherwise the original poster won't get a notification that you have replied, only I will.
However, I don't understand your analysis of the problem, and not what your solution would do either. The StreamReader.Read method does not return a boolean, so your code doesn't really make sense.
---
single minded; short sighted; long gone;
|
|
|
|
|
Not really understand your question. But from my guess, you write something like "\n\t" in your SteamReader? If yes, then just replace "\n\t" with "".
Eliz.K
www.oin1.com
|
|
|
|
|
|
Well this is a ridiculous question - the answer is obviously bright blue.
Seriously think about what you are asking here. My suggestions is - work out and write a specification of what your database needs to store and what functionality it needs to expose.
Then look at implementing your database (I assume you will be using SQL) reading tutorials and learning from your mistakes on the way:
http://www.w3schools.com/sql/default.asp
That link provides some good starter information on databases.
You have a lot to learn before you can even begin to considering building a large scale commercial database. I imagine there is a few months work there (only a small amount of building and the rest learning)
Good luck
Dan
|
|
|
|
|
A forum is not going to be the place to ask this kind of question. It is a very broad question, with many different ways it could go. How about asking the people who want the database for some specifications? Have you ever heard of that?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Complete client reqs:
[Rent-a-coder listing]EHS database, $500, completed in 2 weeks[/Rent-a-coder listing]
--
You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer
|
|
|
|
|
Yep, oh, and gotta have some sense of urgency to it :->
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Nidesh - don't follow Dan's advice - bright blue is *NOT* the way to go. Everyone knows that. He was just having a bit of fun.
Environmental Health databases must be designed so the printout of the schema looks like a small dog of an undetermined breed.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
I can insert an image into my richtexbox. But I resize it, the image becomes very bad. Please help me fix this problem. Thank you very much
|
|
|
|
|
If I understand your problem correctly, you have a Windows Form with a RichTextBox control on it. You put an image (jpeg, bitmap, or something) in the RichTextBox and it displays it well. Then you resize the Form and the image no longer looks good. Is that basically correct?
I think the problem is that, although the RichTextBox can display an image, that's not what it is meant to do. Why are you using a RichTextBox instead of PictureBox or other more appropriate control?
BDF
|
|
|
|