?
Solved

access web control from vb class

Posted on 2012-04-13
10
Medium Priority
?
269 Views
Last Modified: 2012-04-17
Hello

i ahve a vb.net web application and i would like to access a control from my .aspx page form my cv class.
0
Comment
Question by:Chris Jones
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 2
10 Comments
 
LVL 1

Author Comment

by:Chris Jones
ID: 37845021
i have tried this but no help

        Dim PlaceHolderContact As New PlaceHolder
        PlaceHolderContact = MainPage.Parent.FindControl("Display")
        PlaceHolderContact.Controls.Add(t)
0
 
LVL 20

Assisted Solution

by:BuggyCoder
BuggyCoder earned 2000 total points
ID: 37845595
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
 
LVL 1

Author Comment

by:Chris Jones
ID: 37851249
i dont realy understand your exmaple
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 1

Author Comment

by:Chris Jones
ID: 37851296
ok i have this in my code now but i get an
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37853596
Can you explain again what you are trying to do? Access a control on master page from content page?
0
 
LVL 1

Author Comment

by:Chris Jones
ID: 37857725
ok got it from your exmple.. now i need to know can i access multiple controls from a class ?
0
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 2000 total points
ID: 37857937
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
 
LVL 1

Author Comment

by:Chris Jones
ID: 37858164
oh perfect thanks
0
 
LVL 1

Author Closing Comment

by:Chris Jones
ID: 37858166
Awesome thanks for the quick response
0
 
LVL 1

Author Comment

by:Chris Jones
ID: 37858177
how do i pass the array over in my web form ?
0

Featured Post

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question