Simple Databinding not working

Posts   
 
    
jguidera
User
Posts: 3
Joined: 08-May-2005
# Posted on: 08-May-2005 21:15:26   

Ok, I must be doing something wrong.

I've got the following:

public class form1 inherits system.windows.forms.form

private m_Customer as customerentity

... ... ..

Private Sub btnRetrieve_Click..... m_customer = new CustomerEntity("ALFKI") txtCustomerID.Databindings.Add("Text", m_customer, "CustomerId") End Sub

The above throws a:

An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll

Additional information: Object type cannot be converted to target type.

Any thoughts? I must be missing something simple....

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 09-May-2005 09:35:06   

The only thing I can think of is that 'CustomerId' isn't a property of the customer entity... (but CustomerID for example).

Please post a stacktrace and the exact line where the exception is thrown in your code.

Frans Bouma | Lead developer LLBLGen Pro
jguidera
User
Posts: 3
Joined: 08-May-2005
# Posted on: 10-May-2005 04:24:24   

Otis wrote:

The only thing I can think of is that 'CustomerId' isn't a property of the customer entity... (but CustomerID for example).

Please post a stacktrace and the exact line where the exception is thrown in your code.

Never mind. Figured it out. I was using an xp themed textbox (which apparently isn't handling it correctly).

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 10-May-2005 09:31:23   

jguidera wrote:

Otis wrote:

The only thing I can think of is that 'CustomerId' isn't a property of the customer entity... (but CustomerID for example).

Please post a stacktrace and the exact line where the exception is thrown in your code.

Never mind. Figured it out. I was using an xp themed textbox (which apparently isn't handling it correctly).

Hmm. A special kind of textbox (3rd party) control? As the normal textbox in winforms is themed, if I'm not mistaken.

Frans Bouma | Lead developer LLBLGen Pro
jguidera
User
Posts: 3
Joined: 08-May-2005
# Posted on: 14-May-2005 23:45:39   

Otis wrote:

jguidera wrote:

Otis wrote:

The only thing I can think of is that 'CustomerId' isn't a property of the customer entity... (but CustomerID for example).

Please post a stacktrace and the exact line where the exception is thrown in your code.

Never mind. Figured it out. I was using an xp themed textbox (which apparently isn't handling it correctly).

Hmm. A special kind of textbox (3rd party) control? As the normal textbox in winforms is themed, if I'm not mistaken.

An openly available themed control that after checking the documentation I found didn't have the databinding support hooked up. They provided an alternative method of hooking the native winforms textbox (which of course does support databinding).... So now that's working correctly.

However, now I'm off to comboboxes..... Grrr...

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 15-May-2005 18:05:02   

jguidera wrote:

Otis wrote:

jguidera wrote:

Otis wrote:

The only thing I can think of is that 'CustomerId' isn't a property of the customer entity... (but CustomerID for example).

Please post a stacktrace and the exact line where the exception is thrown in your code.

Never mind. Figured it out. I was using an xp themed textbox (which apparently isn't handling it correctly).

Hmm. A special kind of textbox (3rd party) control? As the normal textbox in winforms is themed, if I'm not mistaken.

An openly available themed control that after checking the documentation I found didn't have the databinding support hooked up. They provided an alternative method of hooking the native winforms textbox (which of course does support databinding).... So now that's working correctly.

Hmm. Well, glad it has an alternative method which made it possible simple_smile

Frans Bouma | Lead developer LLBLGen Pro
swallace
User
Posts: 648
Joined: 18-Aug-2003
# Posted on: 16-May-2005 15:22:30   

An openly available themed control

Could you tell us what product it was, so we know to look out for this ourselves? Thanks.