Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

access web control from vb class

Posted on 2012-04-13
10
Medium Priority
?
271 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

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…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

610 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