|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to call a sub
Hello All,
I need help to import sub into application. First i will give a little detail how my application is set so you can help me (And so if i ask this question wrong you may be able to sift through the newbieness) I have a componts folder that holds all of my class files (Like my comtrols, alot of my controls have their own namespace, class file) My connection string is in my web.fig file so when ever i create a connection in my class files in my componets folder i write it like so--->... Dim cnn As New SqlConnection(ConfigurationSettings.AppSettings("cnn")) ... When ever i call the function that returns a result for my control i do it like so-> ... Dim GetCompanyProductsFromTopMenu As New ConstructionSuperCenterCom.WindowTreatmentByCompan y dlCom16.DataSource = GetCompanyProductsFromTopMenu.DataListForProductDi splayFromTopMenuSelection(IDCompany, IDCompanyProductCategory) dlCom16.DataBind()... Now, My question here is, how do i get to this sub and correctly implement it? What i am doing here updating, editing, deleting info from a datagrid and i want to move all of this code to my componets folder and make a call from the behind file to the componts in the folder where needed in the behind file. ============Here is a piece of the code from the behind file that i am wanting to move to the componets folder,----- Sub dgProducts_Edit(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) dgUpdateProductRestrictions.EditItemIndex = e.Item.ItemIndex BindData() End Sub Sub dgProducts_Cancel(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) dgUpdateProductRestrictions.EditItemIndex = -1 BindData() End Sub Sub dgProducts_Update(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) 'Read in the values of the updated row Dim iProductID As Integer = e.Item.Cells(1).Text Dim dblPrice As Double = CType(e.Item.Cells(2).Controls(0), TextBox).Text Dim strName As String = CType(e.Item.Cells(3).Controls(0), TextBox).Text Dim strDesc As String = CType(e.Item.Cells(4).Controls(0), TextBox).Text **How would i call the sub dgProducts_Update from the behind file? Like This----> Dim MyUpdate as new (This would be namespace --->ConstructionSuperCenterCom) MyUpdate.dgProducts_Update <----------????? i tried this but did not all the way work.. Can anyone help me on this??? Thank you... Erik.,,.. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > .NET Development > How to call a sub |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|