So nobody knows how to do this?

Z

Zim Babwe

I posted the other day and so far no replies.... :-(





I have a VB Windows Form (VS 2005) and on the form is a datagridview
control. It was populated by:

datagridview1.DataSource = tbl

The table only has two fields, URL_ID and URL.

I would like to change the URL field from text to a DataGridViewLinkColumn.

How can I do this?

Thanks
 
R

rowe_newsgroups

I posted the other day and so far no replies.... :-(

I have a VB Windows Form (VS 2005) and on the form is a datagridview
control. It was populated by:

datagridview1.DataSource = tbl

The table only has two fields, URL_ID and URL.

I would like to change the URL field from text to a DataGridViewLinkColumn.

How can I do this?

Thanks


I can't really think of a way outside of adding the items manually,
but that is only one-way databinding isn't it?

Perhaps Cor will stop by this thread - he seems to be the resident
expert on datagridviews. You may also check out Cor and Ken Tucker's
site at vb-tips.com they have a lot of dgv articles there.

Thanks,

Seth Rowe
 
C

Cor Ligthert [MVP]

Rowe,

For that you don't have to be an expert for the DataGridView, for the latter
Ken took much more time than me (See his codecamp activitities).

Columns is one of the answer, in the use it is so simple that we don't have
one sample on our site only about that, but it is at Microsoft. For the rest
we have a lot of samples as you said both build by Ken and me for the grids
and datatable that is used on our website. It started as a datagrid website.

http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagridview.columns.aspx

I thought that an other option is (although I never tried it in this way) is
using the tablemappings.

http://msdn2.microsoft.com/en-us/library/ks92fwwh.aspx

Cor
 
R

rowe_newsgroups

Rowe,

For that you don't have to be an expert for the DataGridView, for the latter
Ken took much more time than me (See his codecamp activitities).

Columns is one of the answer, in the use it is so simple that we don't have
one sample on our site only about that, but it is at Microsoft. For the rest
we have a lot of samples as you said both build by Ken and me for the grids
and datatable that is used on our website. It started as a datagrid website.

http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagri...

I thought that an other option is (although I never tried it in this way) is
using the tablemappings.

http://msdn2.microsoft.com/en-us/library/ks92fwwh.aspx

Cor

Cor,

Not sure we are on the same page here. The original question was about
having the datasource fill the datagridview with a
DataGridViewLinkColumn instead of the default
DataGridViewTextBoxColumn. I was under the impression that setting the
datasource just appends new columns to the datagridview and doesn't
allow you to set which type of column. Am I wrong in this assumption?

My response was telling the OP that he would probably have to populate
the datagridview manually, by adding his LinkColumns to the columns
collection and then looping through the datatable and then adding the
rows. This is the same method you showed in your first link.

This was the area I hoped you or Ken would shed some light on, because
I was sure one of you had encountered this before. From what I can
tell the second link you posted might address the problem, since it
maps the data to a specific column and won't just append the columns
to the end of the collection. Hopefully the OP will try it out and let
us know.

Thanks,

Seth Rowe
 

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