Table Adapters

  • Thread starter Thread starter Roger
  • Start date Start date
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
 
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 ...........
 
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
 
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().
 
Back
Top