I need some advice on how to use a datagridview properly. I'm
converting a vb6 app to vb.net. In the vb6 application I was passing
an empty datagrid by referene to a class I'd written, I was populating
the datagrid and passing it back to the form all set up for action.
I've tried doing the same in vb.net but the class I've written doesn't
recognise the datagridview. So my question is, is passing the
datagridview from a form class to a class I've written the best way to
populate my datagridview? I'm really keen to have the populating of
the grid done in the class and not on the form. Should I be
inheriting the grid into the class? Is the way I'm passing it
incorrect?
All advice gratefully received.
LL
I'm not sure but it sounds like the problem is that you don't have an:
Imports System.Windows.Forms
statement in the class.
You're right. Oh dear, the joys of a new language.
Thanks a million for your help.
LL
> I've tried doing the same in vb.net but the class I've written doesn't
> recognise the datagridview. So my question is, is passing the
> datagridview from a form class to a class I've written the best way to
> populate my datagridview? I'm really keen to have the populating of
> the grid done in the class and not on the form. Should I be
> inheriting the grid into the class? Is the way I'm passing it
> incorrect?
I am going to counter what "Joe" stated. In a "proper" app, the middle
tier works with data as objects, not as pulled from controls. You are
best to archtiect the solution so the bound data is what you are passing
and not some view from a DataGrid. When you start working with UI
controls, you tightly bind to the UI, making it hard to ever produce
another type of UI for the app without rewriting a huge portion of the
code.
Yes, this may not be an issue for you, but it is something to think
about esp. with the new technology being projectile vomited out at a
high pace.
Peace and Grace,
--
Gregory A. Beamer (MVP)
Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com
*******************************************
| Think outside the box! |
*******************************************
The only trouble can be as it is a anonymous class, but even that you can
first convert tolist.
Cor
"LuvinLunch" <martin...@yahoo.ie> wrote in message
news:d21e0201-9edc-47ae...@r5g2000yqb.googlegroups.com...
Thanks a million for the advice. I thought there might be something I
shoudl be doing that would make the upkeep of my code easier but I
just didnt' know what it was. If either had some sample code of what
you've suggested it'd be much appreciated.
LL