Sorry, I try but I can't solve.
When I debug, I always get the type of Value object as "System.Data.DataRowView".
Ali ihsan,
>>Although, I added .ToString().
>
>Oops...you're right, I neglected to add .ToString(), in addition, you should also check for the Type of the SelectedValue:
>
>
private void cboCustomers_SelectedIndexChanged(object sender, System.EventArgs e)
>{
> object Value = this.cboCustomers.SelectedValue;
> if (Value is String)
> {
> this.txtCustomerID.Text = Value.ToString();
> }
>}
>
>The reason you have to check for the type is because the SelectedIndexChange event fires when the combo box's DisplayMember and ValueMember properties are set at run time, and the type of the SelectedValue is "invalid" at this point. Although some might argue this is "by design", I consider this is a .NET bug!
>
>These properties get set automatically for you by MM .NET. I have tried to reverse the order so I set the combo box BindingSource AFTER setting the DisplayMember and ValueMember properties, but .NET doesn't like that...the combo box doesn't bind properly.
>
>So, long story short, you need to check the type of the value in the SelectedIndexChange event handler.
>
>Regards,