Complete error:
Cannot convert null to 'myNameServer.myStructName' because it is a non-nullable value type
Use class instead of struct.
(temporary solution only, hopefully this post will be edited)
Thursday, May 27, 2010
Enums in C#
correct usage:
class myClass
{
public enum myEnumType {Value1, Value2};
public myEnumType myEnumVariable;
}
class myOtherClass
{
public myFunction()
{
myClass foo = new myClass();
foo.myEnumVariable = myClass.myEnumType.Value1;
}
}
class myClass
{
public enum myEnumType {Value1, Value2};
public myEnumType myEnumVariable;
}
class myOtherClass
{
public myFunction()
{
myClass foo = new myClass();
foo.myEnumVariable = myClass.myEnumType.Value1;
}
}
Monday, May 17, 2010
Number only text box - C# Express Edition
private void txt_FieldName_KeyPress(object sender, KeyPressEventArgs e)
{
if ((e.KeyChar < '0' || e.KeyChar > '9') && e.KeyChar != '\b')
e.KeyChar = '\0';
}
{
if ((e.KeyChar < '0' || e.KeyChar > '9') && e.KeyChar != '\b')
e.KeyChar = '\0';
}
Labels:
c#,
express,
keypress,
number only,
visual studio
Subscribe to:
Posts (Atom)