access web control from vb class

Hello

i ahve a vb.net web application and i would like to access a control from my .aspx page form my cv class.
LVL 1
Chris JonesLead Application Web DeveloperAsked:
Who is Participating?
 
BuggyCoderCommented:
Simple use Array of Control in Constructor:-
Public Class MyType
	Private _control As Control()

	Public Sub New(control As Control())
		_control = control
	End Sub
End Class

Open in new window

0
 
Chris JonesLead Application Web DeveloperAuthor Commented:
i have tried this but no help

        Dim PlaceHolderContact As New PlaceHolder
        PlaceHolderContact = MainPage.Parent.FindControl("Display")
        PlaceHolderContact.Controls.Add(t)
0
 
BuggyCoderCommented:
you have to pass an instance of your control to you vb class like this:-

<asp:Button id="button1" runat="server" />

code behind:-
Public Partial Class _Default
	Inherits System.Web.UI.Page
	Protected Sub Page_Load(sender As Object, e As EventArgs)
		Dim type As New MyType(button1)

	End Sub
End Class

Open in new window


vb class:-

Public Class MyType
	Private _control As Control

	Public Sub New(control As Control)
		_control = control
	End Sub
End Class

Open in new window

0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Chris JonesLead Application Web DeveloperAuthor Commented:
i dont realy understand your exmaple
0
 
Chris JonesLead Application Web DeveloperAuthor Commented:
ok i have this in my code now but i get an
0
 
CodeCruiserCommented:
Can you explain again what you are trying to do? Access a control on master page from content page?
0
 
Chris JonesLead Application Web DeveloperAuthor Commented:
ok got it from your exmple.. now i need to know can i access multiple controls from a class ?
0
 
Chris JonesLead Application Web DeveloperAuthor Commented:
oh perfect thanks
0
 
Chris JonesLead Application Web DeveloperAuthor Commented:
Awesome thanks for the quick response
0
 
Chris JonesLead Application Web DeveloperAuthor Commented:
how do i pass the array over in my web form ?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.