whycantyou

Why can't you bind the Size of a windows form to ApplicationSettings?

Update: Solved, with code I got it working, see my answer below for the code... Original Post As Tundey pointed out in his answer to my last question, you can bind nearly everything about a windows forms control to ApplicationSettings pretty effortlessly. So is there really no way to do this with form Size? This tutorial says you need...

Why can't I declare static methods in an interface?

The topic says the most of it - what is the reason for the fact that static methods can't be declared in an interface? public interface ITest { public static String test(); } The code above gives me the following error (in Eclipse, at least): "Illegal modifier for the interface method ITest.test(); only public & abstract are permi...

Why can't I use a type argument in a type parameter with multiple bounds?

So, I understand that the following doesn't work, but why doesn't it work? interface Adapter<E> {} class Adaptulator<I> { <E, A extends I E>> void add(Class<E> extl, Class<A> intl) { addAdapterFactory(new AdapterFactory<E, A>(extl, intl)); } } The add() method gives me a compile error, "Cannot specify any additional bou...

Why events can't be used in the same way in derived classes as in the base class in C#?

In following code, I want to extend the behaviour of a class by deriving/subclassing it, and make use of an event of the base class: public class A { public event EventHandler SomeEvent; public void someMethod() { if(SomeEvent != null) SomeEvent(this, someArgs); } } public class B : A { public void someOthe...

c# why cant a nullable int be assigned null as a value

Hi Everyone Can someone explain to me why a nullable int cant be assigned the value of null e.g int? accom = (accomStr == "noval" ? null : Convert.ToInt32(accomStr)); What's wrong with that code? Thanks ...

Why can’t variables be declared in a switch statement?

I want to know more about "Why can’t variables be declared in a switch statement?" I read the post but i am not getting it exactly. You can just declare variable inside switch but to decalre and initialize a variable or to declare object of class it gives complie time error. Please explain me.... ...

Why can't we use "this" inside the class?

E,g class Test { public: void setVal(const std::string& str) { this.isVal = str; //This will error out } private: string isVal; }; ...

Why can't you overload the '.' operator in C++?

It would be very useful to be able to overload the . operator in C++ and return a reference to an object. You can overload operator-> and operator* but not operator. Is there a technical reason for this? ...

Why does Java not support type inference for constructors?

E.G. to create an ArrayList of Strings we have to do something like List<String> list = new ArrayList<String>(); whereas it should be able to infer the parameter type for the constructor so that we only have to type List<String> list = new ArrayList(); Why can't the type be infered in the same way that type parameters are infered f...

Why can't I do this with implicit types in C#?

var x = new { a = "foobar", b = 42 }; List<x.GetType()> y; Is there a different way to do what I want to do here? If there's not, I don't really see all that much point in implicit types... ...

Why do I have to give an identifier?

In code: try { System.out.print(fromClient.readLine()); } catch(IOException )//LINE 1 { System.err.println("Error while trying to read from Client"); } In code line marked as LINE 1 compiler forces me to give an identifier even though I'm not using it. Why this unnatural constrain? And then if I type an identifier I'm getting...

Why can't I pass an object of type T to a method on an object of type <? extends T>?

In Java, assume I have the following class Container that contains a list of class Items: public class Container<T> { private List<Item<? extends T>> items; private T value; public Container(T value) { this.value = value; } public void addItem(Item<? extends T> ite...

Question about references in java

I want to know what the difference between : String s = "text"; and : String s = new String("text"); ...

pros and cons of the error "no newline at the end of the file"

can somebody please explain why do we need this error at all, it is really strange, when You use one compiler program works perfectly, but with other it crashes, who invented this thing? ...

Why is prepareWithInvocationTarget: specific to NSUndoManager?

Compare... NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:[performer methodSignatureForSelector:@selector(playFile:)]]; [invocation setSelector:@selector(playFile:)]; [invocation setTarget:performer]; NSString* string = [NSString stringWithString:@"reverse.wav"]; [invocation setArgument:&string atIndex:2]; ...w...