Table Adapters

R

Roger

hi all

I have this line of code
KomfireTableAdapter Komfire = new KomfireTableAdapter
estimator.KomfireDataTable.....
I want the parts in brackets to be a variable
(Komfire)TableAdapter Komfire = new (Komfire)TableAdapter
estimator.(Komfire)DataTable table = (Komfire).getdata...............

So Komfire need to be variable
can that be done?

Thanks

Roger
 
B

Barrie Wilson

Roger said:
hi all
I have this line of code KomfireTableAdapter Komfire = new
KomfireTableAdapter
estimator.KomfireDataTable..... I want the parts in brackets to be a
variable (Komfire)TableAdapter Komfire = new (Komfire)TableAdapter
estimator.(Komfire)DataTable table = (Komfire).getdata...............

So Komfire need to be variable can that be done?

this is not all clear, but:

it appears from line 2 that "Komfire" is the identifier for an instance of
the class KomfireTableAdapter; you can of course give the instance whatever
name you wish .... so in that sense, yes, it can be "variable"

as for the rest of it, I'm not sure what you're doing; Komfire is a member
of estimator??

I *think* what you're looking for is perhaps simpler:

DataTable tbl;

KomfireTableAdapter Komfire = new KomfireTableAdapter();
tbl = Komfire.getdata();

maybe ...........
 
R

Roger

thanks for the reply but i did not explain myself very well

Komfire is part of estimator, but there are a few otherm members.
what i was trying to do is us a selection varaible to create the line
(Komfire)TableAdapter

not sure if that makes any more senese

Roger
 
S

Scott Roberts

Roger said:
thanks for the reply but i did not explain myself very well

Komfire is part of estimator, but there are a few otherm members.
what i was trying to do is us a selection varaible to create the line
(Komfire)TableAdapter

not sure if that makes any more senese


Not really.

If (Komfire)TableAdapter is a Type, have a look at
Activator.CreateInstance().
 

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