emaduddeen
Well-known member
- Joined
- May 5, 2010
- Messages
- 171
- Location
- Lowell, MA & Occasionally Indonesia
- Programming Experience
- Beginner
Greeting Everyone,
Can you look at this code? It's a class module that I made so I can make our application more modular.
In the code there are 3 lines of code which have this as part of it:
FormBrowseAttendance.ComboBoxLookupStudent.
Could you tell me how I can change the coding to refer to this portion of code using these parameters:
pComboBoxName
pNameOfForm
I'm assuming these need to converted is some way but I don't know how to do it.
Thanks.
Truly,
Emad
Can you look at this code? It's a class module that I made so I can make our application more modular.
In the code there are 3 lines of code which have this as part of it:
FormBrowseAttendance.ComboBoxLookupStudent.
Could you tell me how I can change the coding to refer to this portion of code using these parameters:
pComboBoxName
pNameOfForm
I'm assuming these need to converted is some way but I don't know how to do it.
Thanks.
Truly,
Emad
VB.NET:
Imports System.Data.OleDb
Public Class Utilities
' Command object to be used in select, insert, delete and update statements.
'---------------------------------------------------------------------------
Dim objCommand As OleDbCommand
' Declare and Create the connection object to use an SQL query.
'--------------------------------------------------------------
Dim objConnection As New OleDbConnection(My.Settings.ISGL_Database)
' Declare a DataAdapter.
'-----------------------
Dim objDataAdapter As OleDbDataAdapter
' Declare a DataSet.
'-------------------
Dim objDataSet As New DataSet
Public Sub FillPureComponentsComboBoxFromDataAdapter( _
ByVal pComboBoxName As String, _
ByVal pSqlQuery As String, _
ByVal pNameOfForm As String, _
ByVal pDisplayMember As String, _
ByVal pValueMember As String)
' Set up a command to execute the SQL query.
'-------------------------------------------
objCommand = New OleDbCommand(pSqlQuery, objConnection)
objCommand.CommandType = CommandType.Text
' Load data into the ComboBox
Try
objDataAdapter.SelectCommand = New OleDbCommand(pSqlQuery, objConnection)
objDataAdapter.Fill(objDataSet)
FormBrowseAttendance.ComboBoxLookupStudent.DataSource = objDataSet.Tables(0)
FormBrowseAttendance.ComboBoxLookupStudent.DisplayMember = pDisplayMember
FormBrowseAttendance.ComboBoxLookupStudent.ValueMember = pValueMember
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
End Class
Last edited: