|
Hi guys what is wrong with this line? lookupObject is a struct. I just want to initialize the dictionary with the struct as value.
public static Dictionary<string, lookupojbect=""> dicTextLookup = new Dictionary<string, lookupojbect="">();
this is the error: "Error 1 Inconsistent accessibility: field type 'System.Collections.Generic.Dictionary<string,lookupojbect>' is less accessible than field 'dicTextLookup' C:\IL\TranslationController.cs 44"
Thanks
|
|
|
|
|
Could you repost that snippet, but check the "Ignore HTML tags in this message" checkbox when posting? We can't see your full code otherwise.
Is dicTextLookup non-public? Are you exposing the field as public? This error typically occurs if you're trying to expose some private/protected/internal thing as public. For instance
private class MyFoo {}
public class MyBar()
{
public MyFoo instance;
}
|
|
|
|
|
Sorry I didnt know about checking the checkbox, you solved my problem without looking at my code. Great!
|
|
|
|
|
How can I verify that the input in a textbox is numeric?
Jude
|
|
|
|
|
You could use a regular expression, something like RegEx("[0-9]")
only two letters away from being an asset
|
|
|
|
|
Could you point me in the right directioon on how to use RegEx?
Thanx
Jude
|
|
|
|
|
|
try to parse it, between try and catch and if rise exception isnt number
God make a perfect team, the rest have foreigners, Athletic Club Bilbao
|
|
|
|
|
How do I implement this method?
Jude
|
|
|
|
|
Don't implement it that way. Exceptions should be used only for exceptional circumstances, not part of normal code flow.
Rather than doing that, either us a MaskedTextBox (new in .NET 2.0) or use a regular expression to validate the input.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Messianic Instrumentals (with audio)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
When using Framework 2.0 you could use MaskedTextBox .
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Include the Visual Basic library and use the IsNumeric method.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
|
|
Greeeg wrote: a sorted list via a listbox control
|
|
|
|
|
Here is an easy way that doesn't rely on exceptions, regular expressions, or legacy VB libraries:
double numericValue;
bool isNumeric = double.TryParse(myTextBox.Text, out numericValue);
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Messianic Instrumentals (with audio)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Unfortunately there's no int.TryParse method to accompany that one.
|
|
|
|
|
|
Yes, there is an Int32.TryParse().
...or, at least I hope so, because I've used it...
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
dan neely wrote: Unfortunately there's no int.TryParse method to accompany that one.
Fortunately there are:
<br />
Int16.TryParse(string s,out short result)<br />
Int32.TryParse(string s, out int result)<br />
Int64.TryParse(string s,out long result)<br />
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
U can just use a simle java script for that.
Vipin
|
|
|
|
|
Vipin Venugopal wrote: U can just use a simle java script for that.
<input type=text name=txtPostalCode removed="if(!isNS4){if(event.keyCode > 45 || event.keyCode > 57) event.returnValue = false;}else{if(event.which < 45 || event.which > 57) returnfalse;}">
What?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Messianic Instrumentals (with audio)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Thnax for all the input peeps..I am going to try the Int32.TryParse..Btw, what is the best resource for knowing all in the classes and methods ( other than MSDN help )? I don't expect to know them all, but it would be good to have a good reference other than Google...
And Judah's reponse is for keytrokes that are between 0-9, correct?
Jude
|
|
|
|
|
Ahhh..I am using 2003...Int32.TryParse i not available for 1.1, and 2003 doe not support 2.0 from what I know, Corret?
Jude
|
|
|
|
|
Try this.
text box's KeyPress event
if ((int)e.KeyChar >= 48 & (int)e.KeyChar <= 57)
OR
in KeyDown or KeyUp event
if (e.KeyCode >= Keys.D0 & e.KeyCode <= Keys.D9)
this.Text = e.KeyValue.ToString();
Best of Luck.
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|