Classes

  • Thread starter Thread starter kuhrty
  • Start date Start date
K

kuhrty

Hello,

I have created a business class to separate the logic between the UI
and code. I have loaded a dataset called dept. Dept has a few columns
called dept, dept desc, family. I load only department in a drop down
box.

Later on the user get to choose the department and it load the data. I
am trying to create a method that with the drop down box changes it
grabs the department name from the data set. Do I need to
re-instantiate the class in order to run a filter on the dataset for
this information and set it using property.

I am new to alot of this and struggling. I may be proceeding the wrong
way but any advice for code would be helpful
 
Hi kuhrty,

A DataSet is a disconnected copy of data in one or more result sets, tables,
views, etc., in a database. So, you are not going to be dealing directly
with the DataSet for the most part, but with a single table in it. You can
set the DataSource property of a ComboBox Control to a DataSet, a DataTable,
a DataView, or even an Array. If you set it to a DataTable or a DataView,
for example, you can use the DisplayMember to determine which Column is
displayed, and the DataMember to determine which column contains the actual
Value you want to use.

You can then get the record you want by either the Value of the
SelectedItem, or by its index in the Items Collection of the ComboBox. There
is no need to reinstantiate any class, as the class will remain around as
long as you choose to allow it to.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

A lifetime is made up of
Lots of short moments.
 
Back
Top