R
Richard Thornley
Hello,
I need some clarification in creating objects. Consider the following
code... (note: The function InitializeListCombo initializes the combobox)
Private daLists As New OleDbDataAdapter
Private dsLists As New DataSet
Private dvLists As New DataView
msSQL = "SELECT * FROM Lists WHERE Active=True ORDER BY ListName,
ListItem"
'Create the DataAdapter for Categories Recordset
daLists = New OleDbDataAdapter(msSQL, cnADOConverse)
'Fill the Categories Recordset
daLists.Fill(dsLists, "Lists")
'Bind and Initialize cmbPreferredCurrency
dvLists = New DataView(dsLists.Tables("Lists"), "ListName =
'preferredcurrency'", "ListItem", DataViewRowState.CurrentRows)
InitializeListCombo(cmbPreferredCurrency, dvLists, "ListItem",
"ListItem")
'Bind and Initialize cmbHitCounterStyle
dvLists = New DataView(dsLists.Tables("Lists"), "ListName =
'hitcounterstyle'", "ListItem", DataViewRowState.CurrentRows)
InitializeListCombo(cmbHitCounterStyle, dvLists, "ListItem", "ListItem")
'Bind and Initialize cmbDuration
dvLists = New DataView(dsLists.Tables("Lists"), "ListName = 'duration'",
"ListItem", DataViewRowState.CurrentRows)
InitializeListCombo(cmbDuration, dvLists, "ListItem", "ListItem")
'Bind and Initialize cmbAutoRelists
dvLists = New DataView(dsLists.Tables("Lists"), "ListName =
'autorelists'", "ListItem", DataViewRowState.CurrentRows)
InitializeListCombo(cmbAutoRelists, dvLists, "ListItem", "ListItem")
daLists.Dispose()
daLists = Nothing
dsLists.Dispose()
dsLists = Nothing
dvLists.Dispose()
dvLists = Nothing
Did I just create ONE Dataview object named dvLists or did I create FOUR
DataView objects all named dvLists? I am very confused about the New
keyword. I declare dvLists New in the Private statement and then four other
times.
If anyone could make this clear I would really appreciate it. Also... can
anyone tell me if the above code is structured correctly or a better way to
write the code if it is not correct?
Thanks,
Richard
I need some clarification in creating objects. Consider the following
code... (note: The function InitializeListCombo initializes the combobox)
Private daLists As New OleDbDataAdapter
Private dsLists As New DataSet
Private dvLists As New DataView
msSQL = "SELECT * FROM Lists WHERE Active=True ORDER BY ListName,
ListItem"
'Create the DataAdapter for Categories Recordset
daLists = New OleDbDataAdapter(msSQL, cnADOConverse)
'Fill the Categories Recordset
daLists.Fill(dsLists, "Lists")
'Bind and Initialize cmbPreferredCurrency
dvLists = New DataView(dsLists.Tables("Lists"), "ListName =
'preferredcurrency'", "ListItem", DataViewRowState.CurrentRows)
InitializeListCombo(cmbPreferredCurrency, dvLists, "ListItem",
"ListItem")
'Bind and Initialize cmbHitCounterStyle
dvLists = New DataView(dsLists.Tables("Lists"), "ListName =
'hitcounterstyle'", "ListItem", DataViewRowState.CurrentRows)
InitializeListCombo(cmbHitCounterStyle, dvLists, "ListItem", "ListItem")
'Bind and Initialize cmbDuration
dvLists = New DataView(dsLists.Tables("Lists"), "ListName = 'duration'",
"ListItem", DataViewRowState.CurrentRows)
InitializeListCombo(cmbDuration, dvLists, "ListItem", "ListItem")
'Bind and Initialize cmbAutoRelists
dvLists = New DataView(dsLists.Tables("Lists"), "ListName =
'autorelists'", "ListItem", DataViewRowState.CurrentRows)
InitializeListCombo(cmbAutoRelists, dvLists, "ListItem", "ListItem")
daLists.Dispose()
daLists = Nothing
dsLists.Dispose()
dsLists = Nothing
dvLists.Dispose()
dvLists = Nothing
Did I just create ONE Dataview object named dvLists or did I create FOUR
DataView objects all named dvLists? I am very confused about the New
keyword. I declare dvLists New in the Private statement and then four other
times.
If anyone could make this clear I would really appreciate it. Also... can
anyone tell me if the above code is structured correctly or a better way to
write the code if it is not correct?
Thanks,
Richard