combo bor fill ?

I'm stuck again,

Here it is:
        If sform.CstPartsPricing_DS1.CstPrtsPricing_ETC_DataTbl.Rows.Count = 1 Then
            sform.cboCstPrtsPrChgd.SelectedIndex = Nothing
            sform.cboCstPrtsPrChgd.SelectedIndex = sform.cboCstPrtsPrChgd.Items.IndexOf _
                (Trim(sform.CstPartsPricing_DS1.CstPrtsPricing_ETC_DataTbl.Rows(0).Item("str_CstPrtsPriceCrgd").ToString))
           sform.CstPartsPricing_DS1.CstPrtsPricing_ETC_DataTbl.AcceptChanges()
        Else
        End If

I have an unbound combo box that I am (TRYING) to fill from a recalled DS the above code works sometimes and sometimes not
It works the first time after the form is loaded but then the inconsistency starts - I've tried to relocate the code so that it's the last process running but can't alter the behavior - can anyone tell me if the .selectedindex property is the correct way the proceed here or not Is there another property I should change - the second recall is where is problem starts.

What I mean by "WORK" is that there is no errors and the combo box gets populated - there are 2 items in the collections???
What I mean by "NOT-WORK" is that there is no errors and the combo box "DOESN'T " get populated - there are 2 items in the collections???
MBHEY131Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
That sounds like a logic problem, but it is difficult to understand your question.  Are you saying that the ComboBox doesn't get filled with anything?  I don't see where that happens...
0
MBHEY131Author Commented:
yeah, it gets nothing at all in the viewable box - I'm changing to bound
0
ChloesDadCommented:
You should use the add method to add items to the combo box

sform.cboCstPrtsPrChgd.Add("text1")
sform.cboCstPrtsPrChgd.Add("text2")
sform.cboCstPrtsPrChgd.Add("text3")

Open in new window


will add 3 items to the combo box.

You can then use selecteditem to get/set the selecteditem
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Bob LearnedCommented:
I use bound ComboBox and ListBox controls all the time, and they are perfectly fine.  Can you show me where you are binding the ComboBox, and setting DisplayMember and/or ValueMember?
0
MBHEY131Author Commented:
I use bound ComboBox and ListBox controls all the time, and they are perfectly fine.  Can you show me where you are binding the ComboBox, and setting DisplayMember and/or ValueMember?
++++++++++++++++++++++++++
In the IDE by right clicking the combo box and checking "use bound controls" and then setting the members there

that's my general way of handling combo boxes anyway,  but this particular box presents some other challenges so I thought the unbound way to go was easier, I was incorrect, again.!
0
MBHEY131Author Commented:
will add 3 items to the combo box.

 You can then use selecteditem to get/set the selecteditem
++++++++++++++++
that's what I was trying to get away from - I am going to setup a user interface (that's not really needed, now anyway) but in the future quite possibly it will be needed so I my as well get the coding handled now!
0
Bob LearnedCommented:
Here is an example of how I always bind a ComboBox:

Dim employeeList As List(Of Employee) = DataLayer.GetAllEmployees()

EmployeeSelector.DisplayMember = "FullName"
EmployeeSelector.ValueMemer = "EmployeeId"
EmployeeSelector.DataSource = employeeList

Open in new window

0
MBHEY131Author Commented:
Another ?
vb.net visual studio 2012

1. I added some columns to a datatable in a SQL database the "SERVER EXPLORER"
 AND SAVED AND UPDATED!

2. I then added the same columns (MANUALLY) to an existing DS in the "EDIT DATASET WITH DESIGNER" portion of the DATA SOURCES

The problem is that in the SOURCE property of the column in the DS those new columns are not part of the DS

my ?: how do I get the newly added columns of the database on to the DS I'm working with
and I realize I may be going about the all wrong - If so, can I have direction?
0
Bob LearnedCommented:
It has been waaaay too long for me and the designers, since I dislike them so much.  It sounds like a disconnect somewhere, like updating one, and using another.
0
MBHEY131Author Commented:
Found the Answer:

Right click on the dataset object you want to update (on the strip at the bottom of your viewpane)

Select "Edit in Dataset Designer"

in the dataset designer, right click on the header of the table you want to add a column to

select configure... this will bring up the sql statement that is used to draw values into the dataset for this table

Edit the sql to include the column you want to include in your dataset's table and click finish i.e. in the select statement, include your columns name in the list

close the dataset designer then go to any controls (in my case its a datagridview), click on the tasks arrow (top right hand corner next to the handle) and select add column

select the newly created column from the list of databound columns and click "add"

select "edit columns" from the task menu

move the column to the correct position (it will always be placed as the last column in your grid and you may not want it to be the last column)

voila, I know its hardly snappy but it beats the hell out of deleting the dataset and then fixing up all the coding errors that come up... also after doing it a few times it'll be like second nature (I hope)

regards

++++++++++++++++++++++++++++++++++++++

Thought I would post this - and thank the author
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MBHEY131Author Commented:
Found it in Google
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.