Datagrid selection

  • Thread starter Thread starter Niels
  • Start date Start date
N

Niels

Hi There,

I have a form with a datagrid, and some text/combo-boxes and a button.
When I select a record in the datagrid an press the button I want to
see the valeus of the cells from tehe selected record in the
text/combo-boxes.

At this point I only get the first record shown even when i select the
second record.

The code for showing the values is:

edtTitel.Text = m_rstTblFilms.Fields("Titel").Value

But I cant find anywhere a code to let it apply on the selected
record.

Can anyone show me the right direction???

ps. I'm using an ADODBconnection
 
Hi Niels,
I have a form with a datagrid, and some text/combo-boxes and a button.
When I select a record in the datagrid an press the button I want to
see the valeus of the cells from tehe selected record in the
text/combo-boxes.

I do not understand that at all, you select a record in the datagrid, you
push on a button, and want to see the selected values from the selected
records in the text and in the comboboxes.

Where do you want to see the values and what values you want to see?

The code you are showing is how to set a field from a recordset row in a
textbox nothing more.

Sorry, I real have tried 5 times to understand what you are after.

Cor
 
the datagrid is for viewing an selecting only
I want to be able to make changes in the text and comboboxes.
So when I have 3 colums in the Datagrid (lets say: Name, Adress and
city) each colum is linked to a box. (like a fill-in form)

My next step is to try to save the changed values into the database
again.

I'm still a beginner in programming in VB.net so 'm trying to find out
what is possible and how to program those things.

I hope you understand better now.

Anyway thanks for your reply

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Hi Niels,

You are using a recordset, that makes it very difficult to work with a
datagrid.

When you want to use that recordset, than you have first to make from your
recordset a kind of table, there are a lot om those you can take however not
the recordset because that does not fit on a datagrid, while a datatable is
the most easy one.

You have to bind that table to the datagrid and you can fill the table one
by one using those textboxes and comboboxes as you said.

Than you have to update your recordset with that table again

And than you can update it to your database.

And that while there are much more easier ways to go.

Did you ever look in the resource kit to those very simple samples.

VB.net Resource kit
http://msdn.microsoft.com/vbasic/vbrkit/default.aspx

And if you have problems installing the resource kit
http://msdn.microsoft.com/vbasic/vbrkit/faq/#installvdir

There are in that resourcekit very few update databasse commands, when you
are that far reply here or look at the "dataadapter update" and do not
forget the "commandbuilder".

The one you sure forget is to take care of the last update with the
"endcurrentedit".

However you can start and ask your questions in this newsgroup, you sure get
answers.

You can crosspost it to the newsgroup,
microsoft.public.dotnet.framework.adonet than as well.

I hope this helps?

Cor
 
My intension is to make a kind of fill-in form
The Datagrid will only be for reading an selecting.

When a record is selected and I press the button the values of each cell
in the selected record will be copied to the text an comboboxes so that
I can edit them.

The next step will be to save the edited values into the database.

Maybe this is not the effective way, but i'm a beginner in programming
VB.net and I'm exploring what is possible an how to program.

I hope you understand, what I'm trying to explain :-)

Anyway, thanks for your reply

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Thanks for the reply, i'm going to have a look at all of it.

The RecourceKit cd didnt work for me i got installation errors. so i'm
going to try the suggestions you made.

Thanks again for all.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Back
Top