|
Martin# wrote: Maybe, he is only using .Net 1.1 (like I do).
.NET Framework
Supported in: 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0, 1.1, 1.0
Perhaps it's a failing of mine that I read the documentation? Who knew.
Abandon hope all ye who answer here.
Pete O'Hanlon - the General Discussions forum
|
|
|
|
|
led mike wrote: .NET Framework
Supported in: 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0, 1.1, 1.0
Perhaps it's a failing of mine that I read the documentation? Who knew.
No, but you read the doc correct and do not mix up the methods!
(Kicking my ass)
All the best,
Martin
|
|
|
|
|
Martin# wrote: (Kicking my ass)
don't be so emotional about software development. I have read and misunderstood all sorts of things. I'll probably do it at some point today. You just correct it and move on.
led mike
|
|
|
|
|
Man, led mike, one would hardly like to post any question again when you send an reply like this...
I dont think your link solves my problem.
let me try to explain:
IsPublic IsAssembly IsFamily IsFamilyOrAssembly IsFamilyAndAssembly
Public True False False False False
Internal False True False False False
Protected False False True False False
Protected Internal False False False True False
FieldInfo has these properties (IsPublic, IsAssembly, IsFamily, IsFamilyOrAssembly and IsFamilyAndAssembly)
but the EventInfo does not have them...
modified on Tuesday, March 11, 2008 11:28 AM
|
|
|
|
|
Paw Jershauge wrote: Man, one would hardly like to post any question again when you send an reply like this
Yes, I have a very sarcastic attitude because we get some real monkeys here on CodeProject. Perhaps in your case I have been to harsh.
Paw Jershauge wrote: I dont think your link solves my problem.
You could be correct because I have not gone to the trouble to implement it and prove that it works. However it seems from the documentation that if you call GetEvent() with a name and the BindingFlags you are interested in you can determine the information your original post asked about:
Paw Jershauge wrote: Does anyone know how to get the modifier of an Event?
So you can't "get" it but you can determine it, yes? There could also be a more direct way to "get" it, I don't know but at least you are not stumped at this point. If I wanted to know more I would continue to research the documentation.
led mike
|
|
|
|
|
I have be researching the document, and tried alot of the samples provided by Microsoft, but i have yet to find the correct way to handle this problem.
EventInfo[] AllEvents = type.GetEvents();<br />
foreach(EventInfo ei in AllEvents)<br />
{<br />
string modifier = ...[The code that solves the modifiers]...<br />
string eventfullname = modifier + " " + ei.Name;<br />
}<br />
Just example...
|
|
|
|
|
As this was really troubling me. i found the solution from an guy called boothwine on the MSDN forum.
I seems that one would have to do following:
EventInfo[] AllEvents = type.GetEvents();<br />
foreach(EventInfo ei in AllEvents)<br />
{<br />
string modifier = "";<br />
if(ei.GetAddMethod(true).IsPrivate)<br />
modifier = "Private"<br />
else<br />
....<br />
string eventfullname = modifier + " " + ei.Name;<br />
}
The GetAddMethod returns an MethodInfo this helps...
Thanks for taking the time to try an help me...
|
|
|
|
|
Hi,
I beleive this sample code is in C#:
string cleanString = String.Empty;<br />
Regex reg = new Regex("[A-Z]|[a-z]");<br />
MatchCollection coll = reg.Matches(<MyStringGoesHere>);<br />
for(int i = 0; i < coll.Count; i++)<br />
{<br />
cleanString = cleanString + coll[i].Value;<br />
}
See, i want to remove all characters that do not fall in the A-Z or a-z OR 0-9 category AND replace it with a space...
example test123t3er = test t er
Am i wrong in saying that the Regex reg = Regex("[A-Z]|[a-z]") CAN IT BE: Regex reg = Regex("[A-Z]|[a-z]|[0-9]") ???
AND the cleanString = cleanString + coll[i].Value;
CAN I DO A TEST: IF(coll[i].Value == String.Empty) THEN cleanString = cleanString + " " ; ELSE cleanString = cleanString + coll[i].Value ???? - in this way i add space if the character is not in the above category????
So please help me convert the very top section of code and i will build from there...
Thank you in advance...
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
I believe this is the VB.Net code
<br />
Dim cleanString As String = [String].Empty <br />
Dim reg As New Regex("[A-Z]|[a-z]") <br />
Dim coll As MatchCollection = reg.Matches(<MyStringGoesHere> ) <br />
For i As Integer = 0 To coll.Count - 1 <br />
cleanString = cleanString + coll(i).Value <br />
Next<br />
|
|
|
|
|
wow, thanks... that was super fast....
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
Your welcome
|
|
|
|
|
You could easily do this in a RegEx by itself and avoid looping through the matches. \W captures all non-word characters (anything not a-z A-Z or 0-9), so you can then just use the Replace method of the Regex class.
Dim resultString As String
resultString = System.Text.RegularExpressions.Regex.Replace("ABC$%123*>890!#XYZ", "\W", " ")
I haven't done VB since VB6, but I assume that should work as it's a simple statement.
|
|
|
|
|
Hi,
I need to write an Windows Application where the user authenticate against a SQL 2005 Server. What I need is to have a custom authentication and authorization system that's available when building ASP.NET apps.
How would I go about finding out how to type in a Username and Password and then authenticate against a SQL server.
Thank you
Illegal Operation
Making Computer Software Talk
|
|
|
|
|
Illegal Operation wrote: How would I go about finding out how to
Step #1: Read the documentation
Step #2: Have a beverage
Step #3: Repeat steps 1 and 2 until you understand the documentation
led mike
|
|
|
|
|
Hi all,
im working on a Solution to grab all Files in a Directory, but the Compiler woudn't accept my Code. He says all the Time (string have no definition for "GetFiles"
Here is my Code
private void Form3_Load(object sender, EventArgs e)
{
string dir = @Application.StartupPath + "\\XML\\";
DirectoryInfo tdir = new DirectoryInfo(dir);
FileInfo[] dateien = dir.GetFiles(); //<-- Here the Compiler underline GetFiles as a Mistake, why
}
Why he do that?
Thanks for helping
Daniel
|
|
|
|
|
Hi, if file name (string[]) list is enough for you, you could use Directory.GetFiles(dir) static method too. (That's what I usually use, dunno why your code shows error.)
Oh, your code should say "tdir.GetFiles()" I think
|
|
|
|
|
Hi,
climbah wrote: Here the Compiler underline GetFiles as a Mistake, why
climbah wrote: Why he do that?
it sits right in front of you, there is dir and there is tdir, they ar not the same.
if you want to program, you should be able to spot a mistake in the line the
compiler tells you is wrong; rest assured, the compiler will be right almost
all the time, and way more often than you are.
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.
|
|
|
|
|
Thank you alot, Ferenc Veres, it was that, what you said, the code should say tdir instead of dir.
if you want to program, you should be able to spot a mistake in the line the
compiler tells you is wrong; rest assured, the compiler will be right almost
all the time, and way more often than you are.
I know that i should be able to analyse and interpret compiler mistakes, and i even dont know, why i put dir before getfiles()
Maybe it wasnt my day yesterday, ... anyway thank you for your help and maybe next time i can help you
Daniel
PS: Sorry about my English, i know, it isn't the best
|
|
|
|
|
Hi,
I am looking to impliment the Security Application Block from the Enterprise Library 3.1.
Does anyone have a good tutorial or sample code I can look at?
Thanks...
Illegal Operation
Making Computer Software Talk
|
|
|
|
|
Illegal Operation wrote: Does anyone have a good tutorial or sample code I can look at?
They hide those in the documentation. Good luck, you're going to need it.
Reference Implementations are executable sample applications that demonstrate patterns & practices guidance in action.
led mike
|
|
|
|
|
How can I put the pixel in GDI+.Please don't go to image processing.
There is no tool avalible in C# to put the pixel.
Anybody hep me to get this answer.
Continue...
|
|
|
|
|
You can use Graphics.FillRectangle with a width and height of 1.
Standards are great! Everybody should have one!
|
|
|
|
|
why are you going to FillRectangle that is use for draw rectangle.
C++ and VC++ have set pixel.
Continue...
|
|
|
|
|
why are you going to FillRectangle that is use for draw rectangle
Well, I don't: I've never needed a SetPixel method, really. I'm just giving you a quick fix.
Standards are great! Everybody should have one!
|
|
|
|
|
What is a pixel if not a rectangle of size 1x1?
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|