Help Combobox selected value when form loads.

B

Bob

Hello:

I have a windows form with a combobox that gets data from one table and
stores the value in another. The database ia an SQL server DB.

The problem is when the form loads, the value in the combobox isn't the
correct value that is in the SelectedValue table.

When I use the me.BindingContext on a button object, it works fine as I page
through each record but when the form initialy loads, it displays the wrong
value. If I put a textbox on the form and bind it to the same field as the
SelectedValue for the combobox, the correct value is displayed in the
textbox.

Funny thing is this works fine if I do the samething using an Access DB
behind my form.

Anyone else ever see this?

TIA

Bob
 
N

ng

I've had the same thing - I set a flag, boolFormLoading, set to TRUE in
Sub New. I do all my configuration, then set the flag to FALSE. Then,
in the combobox.selectedindexchanged event, I exit that sub if
boolFormLoading is TRUE.

T
 
B

Bob

ng:

Thanks for respnding. I didn't think anyone would respond.

I finaly used .Position + 1 then .position - 1 when the form loads and it
worked.

Later I was working on another project using SQL backend and it worked
without having to do that so I went back to this project, created a new form
from scratch and all the dataadapters and dataset and it worked fine. Must
be a bug in VS. I noticed a lot of strange things like that in other
projects.

Thanks

Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top