Home All Groups Group Topic Archive Search About

Changing text boxes contents interactively

Author
12 Apr 2005 9:14 PM
TS
Hi everyone,
In my windows form, I have a combo box that is bound to a column (child id)
in an SQL database table. When a user select a child id from the combo box, I
want two text boxes in the same form to show the first and last name of that
particular child id that the user selected. What is the code for that?

Thanks a lot.

--
TS

Author
12 Apr 2005 9:24 PM
Chris
you have already set your datasource to your combo box
so onchange event

I do not know how you populate your combo box but i do it as
dim ds as new dataset
ds = database get record call
combobox1.displaymember = ds.tables(0).item("BLA")
combobox1.valuemember = ds.tables(0).item("BLA#")
combobox1.datasource = ds.tables(0)




To get the values out


dim dt as datatable
dim datar as datarow
dim dr as datarow()
dt = combobox1.datasource.table(0)

'returns an array of rows
dr = dt.select("Databasefield = " & combo1.selectedvalue )

for each datar in dr
'you will only have 1 datarow if your selecting on the         primary key

next


Show quoteHide quote
"TS" <T*@discussions.microsoft.com> wrote in message
news:2377C3E0-0F08-4602-B6E6-41A107D500BD@microsoft.com...
> Hi everyone,
> In my windows form, I have a combo box that is bound to a column (child
> id)
> in an SQL database table. When a user select a child id from the combo
> box, I
> want two text boxes in the same form to show the first and last name of
> that
> particular child id that the user selected. What is the code for that?
>
> Thanks a lot.
>
> --
> TS