|
See above for the solution proposed by leppie, which will work, however I prefer:
string invalidChar = @"' ` "" # ";
string[] invChar = invalidChar.Split(' ');
I find it more readable.
Chris
|
|
|
|
|
Both option works , I tested it
Thank you both
|
|
|
|
|
If we are going for readable:
char[] invalidCharacters = { '"', ',', '$', '\'' };
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
I hadn't thought of that - much neater. For things like file paths it is useful to know about using @ as well.
Chris
|
|
|
|
|
Hi, I'm currently programming ASP.NET and C#. I'm new to ASP.NET and I was wondering, is there a way to right-click a control and select view source ? Is there a add-in that does that or an option.
I find it hard to follow the HTML code to find the button I could have just click a button to view the source.
If seems to be working one way only, if I select in the source, the control became selected, but if I select the control, the source get back to the top.
So is there anyway to view the source of a control ?
|
|
|
|
|
Correction, to make leppie happy, the Visual Designer.
You would be surprised at just how fast you can work in HTML without it once you are used to it.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Well I use the html code often, but something I don't want to scroll throught 20 pages of code just to find the button in the table in the div tag in the middle of the page. (just to change an OnClientClick event)
|
|
|
|
|
Hit F4 and use the properties window in conjunction with the Visual Designer for properties like that.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
If you are using VS2008 there is an additional tab at the bottom, SPLIT. Its shows the design view and source, highlight in design highlights the source.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
It does not work, if I highlight the source, it hightligth the controls, but it's only one way, if I highlight the control, it does not highlight the source.
|
|
|
|
|
Strange, it works for me - just a single click on the control highlights the source (you do have to scroll to the right place in the source, it does not automatically bring it into view though).
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi,
Suppose I have this class
public class MyObject
{
public enum ChangeOptions
{
Orientation,
Size,
Position
}
}
How could I create a member variable that could store a set of ChangeOptions? Do I have to use List<ChangeOptions> ? I'd like a easy and fast way to know from this variable whether a ChangeOptions is in this set or not. I thought about using const int things and use & operators, but I think enum is nicer.
Thanks,
Dirso
|
|
|
|
|
[Flags]
public enum ChangeOptions
{
Orientation = 1,
Size = 2,
Position = 4
}
A variable of type ChangeOptions can now accept multiple individual settings
ChangeOptions opts = ChangeOptions.Size | ChangeOptions.Position;
bool optsContainsSize = ((ChangeOptions.Size & opts) != 0);
|
|
|
|
|
I should probably delete my post so it doesn't look like plagiarism :p
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
I voted for both!! Thank you so much guys!!
Thanks,
Dirso
|
|
|
|
|
Just one question, I know the best way for that is Power of 2 values, but what if I have about 40 flags for ChangeOptions? The number will be huge. Is that a problem? Is it limited by the int size?
Thanks,
Dirso
|
|
|
|
|
Yes. However, I believe you can define the enum as Int64.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Ya as Ennis says, just make your enum a long
public enum MyLongEnum : long
{
}
|
|
|
|
|
Use the bit flags option
[BitFlags]Sometims it is just too early[Flags]
public Enum ChangeOptions{
Orientation = 1,
Size = 2,
Position = 4
}
Then in code on ChangeOptions variable will be able to store all options.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
From your responses to the other I suspect that Flags is what you want, but you could also use HashSet<ChangeOptions> if that meets your requirements.
|
|
|
|
|
I liked the idea of a HashSet
|
|
|
|
|
Good, as far as I'm concerned HashSet is the only reason to go to .net 3.5 -- even though it's not as expressive as I'd like.
|
|
|
|
|
I store them as int , and the reconstitute them with a favorite little function of mine that verifies that the int value is valid inside the enum.
does not exist in the enumeration definition</param>
public static T IntToEnum<T>(int value, T defaultValue)
{
T enumValue = (Enum.IsDefined(typeof(T), value)) ? (T)(object)value : defaultValue;
return enumValue;
}
In the examples posted by another user, ordinals of 1, 2, and 4 were used. If you called my function with an invalid value, it would gracefully recover by returning the specified default enum value. So...
ChangeOptions changeOption = IntToEnum(5, ChangeOptions.Orientation)
...would result in changeOption being set to ChangeOptions.Orientation (because 5 is an invalid ordinal), while doing this...
ChangeOptions changeOption = IntToEnum(2, ChangeOptions.Orientation)
...would result in changeOption being set to ChangeOptions.Size (because 2 is a valid ordinal).
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Good Morning,
I'm searching for info how to Print out the info from the datagridview
This is a little urgent
Regards
Arnold
|
|
|
|
|
Atis wrote: I'm searching for info how to Print out the info from the datagridview
Good luck. Do you know where to search?[^]
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|