473,772 Members | 3,786 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Call a function on another WebForm?

Would like to call the TabShow function on WebForm InOutHost from another
WebForm in same project, but cannot figure out how to get a reference. Can
this be done? In this statement: Call InOutHost.TabSh ow("pagBoard") , the
reference to InOutHost is not resolved. Thanks, Dean S
Partial Public Class InOutHost

Inherits System.Web.UI.P age

'function

Public Sub TabShow(ByVal strTabName As String)

Select Case strTabName

Case "pagSearch"

tabInOut.Select edTab =
tabInOut.Tabs.I ndexOf(tabInOut .Tabs.FromKey(" pagSearch"))

Case "pagBoard"

tabInOut.Select edTab =
tabInOut.Tabs.I ndexOf(tabInOut .Tabs.FromKey(" pagBoard"))

Case Else

'error message

End Select

End Sub

End Class

Partial Class Search

Inherits System.Web.UI.P age

Call InOutHost.TabSh ow("pagBoard")

End Class
Apr 3 '06 #1
3 3520
Create a base class, or a utility function. You want to access a member of
a something that doesn't exist. If this is truly functionality that both
pages offer, you should place it in a base class, which inherits Page, and
make your 2 pages inherit from it

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Dean Slindee" <sl*****@charte r.net> wrote in message
news:vV******** ***@fe07.lga...
Would like to call the TabShow function on WebForm InOutHost from another
WebForm in same project, but cannot figure out how to get a reference.
Can this be done? In this statement: Call InOutHost.TabSh ow("pagBoard") ,
the reference to InOutHost is not resolved. Thanks, Dean S
Partial Public Class InOutHost

Inherits System.Web.UI.P age

'function

Public Sub TabShow(ByVal strTabName As String)

Select Case strTabName

Case "pagSearch"

tabInOut.Select edTab =
tabInOut.Tabs.I ndexOf(tabInOut .Tabs.FromKey(" pagSearch"))

Case "pagBoard"

tabInOut.Select edTab =
tabInOut.Tabs.I ndexOf(tabInOut .Tabs.FromKey(" pagBoard"))

Case Else

'error message

End Select

End Sub

End Class

Partial Class Search

Inherits System.Web.UI.P age

Call InOutHost.TabSh ow("pagBoard")

End Class

Apr 3 '06 #2
Both WebForms exist in the same project. Each has a very distinct/different
task to accomplish, so they have nothing (but residing in the same project)
in common. Can you tell me whether it is possible for two WebForms to
communicate with each other. This can be done with WinForms, easily. Just
want to know if it's possible with WebForms, and how.
Thanks,
Dean S
"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:Oy******** ******@TK2MSFTN GP10.phx.gbl...
Create a base class, or a utility function. You want to access a member
of a something that doesn't exist. If this is truly functionality that
both pages offer, you should place it in a base class, which inherits
Page, and make your 2 pages inherit from it

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Dean Slindee" <sl*****@charte r.net> wrote in message
news:vV******** ***@fe07.lga...
Would like to call the TabShow function on WebForm InOutHost from another
WebForm in same project, but cannot figure out how to get a reference.
Can this be done? In this statement: Call InOutHost.TabSh ow("pagBoard") ,
the reference to InOutHost is not resolved. Thanks, Dean S
Partial Public Class InOutHost

Inherits System.Web.UI.P age

'function

Public Sub TabShow(ByVal strTabName As String)

Select Case strTabName

Case "pagSearch"

tabInOut.Select edTab =
tabInOut.Tabs.I ndexOf(tabInOut .Tabs.FromKey(" pagSearch"))

Case "pagBoard"

tabInOut.Select edTab =
tabInOut.Tabs.I ndexOf(tabInOut .Tabs.FromKey(" pagBoard"))

Case Else

'error message

End Select

End Sub

End Class

Partial Class Search

Inherits System.Web.UI.P age

Call InOutHost.TabSh ow("pagBoard")

End Class


Apr 4 '06 #3
A WebForm is just a class.

When a page is requested, an instance of the given webform is created.

No instance of the 2nd webform exists, so only static/shared members can be
accessed. In other words you can't access Page2 because it doesn't exist at
that given time.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Dean Slindee" <sl*****@charte r.net> wrote in message
news:ZP******** ******@fe06.lga ...
Both WebForms exist in the same project. Each has a very
distinct/different task to accomplish, so they have nothing (but residing
in the same project) in common. Can you tell me whether it is possible
for two WebForms to communicate with each other. This can be done with
WinForms, easily. Just want to know if it's possible with WebForms, and
how.
Thanks,
Dean S
"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:Oy******** ******@TK2MSFTN GP10.phx.gbl...
Create a base class, or a utility function. You want to access a member
of a something that doesn't exist. If this is truly functionality that
both pages offer, you should place it in a base class, which inherits
Page, and make your 2 pages inherit from it

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Dean Slindee" <sl*****@charte r.net> wrote in message
news:vV******** ***@fe07.lga...
Would like to call the TabShow function on WebForm InOutHost from
another WebForm in same project, but cannot figure out how to get a
reference. Can this be done? In this statement: Call
InOutHost.TabSh ow("pagBoard") , the reference to InOutHost is not
resolved. Thanks, Dean S
Partial Public Class InOutHost

Inherits System.Web.UI.P age

'function

Public Sub TabShow(ByVal strTabName As String)

Select Case strTabName

Case "pagSearch"

tabInOut.Select edTab =
tabInOut.Tabs.I ndexOf(tabInOut .Tabs.FromKey(" pagSearch"))

Case "pagBoard"

tabInOut.Select edTab =
tabInOut.Tabs.I ndexOf(tabInOut .Tabs.FromKey(" pagBoard"))

Case Else

'error message

End Select

End Sub

End Class

Partial Class Search

Inherits System.Web.UI.P age

Call InOutHost.TabSh ow("pagBoard")

End Class



Apr 4 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1450
by: Andrew | last post by:
Hi, Until now, I have used a single webform for my web app, and everything's been OK. Now, I've decided to create a main menu webform. So, I've got two webforms. Using Visual Studio .NET (with C#), I've made the menu webform the "start page", but I am unable to change to the other webform. I plan to have several webforms, all of which will be activated from the main menu webform by clicking on a button.
3
1852
by: Prasad Patil | last post by:
Hi, I have a webform, The link on the webform should call the exe program installed on the client machine when the user click the link on the webform. It should run the exe installed on the client machine. I am not able to run the client application from my webform. Any suggestions or link would be great help. Thanx Prasad
3
1887
by: Olly | last post by:
Hi all: Sorry for a dumb question, but how to define the following JS function? Many thanks. Olly ========> function checkForm()
6
1370
by: dave | last post by:
I have a webform with many checkboxes on it. I want the user to be able click on a button and the page be posted to another webform so that I can capture which checkboxes were selected. For all other buttons on the page i want the page to be reposted back to the same webform. What is the best method to accomplish the above? thx
27
2856
by: Jason Shohet | last post by:
I have an ascx control, and it needs a value called 'orgID' which the parent page will have. I want to avoid the parent page setting values in fields on the ascx control since this violates encapsulation principles, SO... I want to know if InvokeMember can be used to return a value from the parent. ie: Type myParent = this.Page.GetType(); string strOrgid = myParent.InvokeMember("GetOrgID", System.Reflection... null, this.Page, new...
3
1876
by: Shasta | last post by:
Using VB.NET how can I call a java Function from WebForm Button control? Any example code:? -- Tek Gurus Inc President
9
1413
by: Leon | last post by:
I have a webform in which when the user press generate button the form generate six unique ramdon numbers, the user can also type these six numbers in manually in any order. however, the user can also press a post button that post these six numbers into the database. My problem is that these six numbers need to be posted to the database from less to greatest, and all of my code is within the business tier class not the code behind class. ...
2
2985
by: Luqman | last post by:
How can I open another WebForm in ASP.Net / VS 2005 without closing the Current Webform. I tried using Server.Transfer("Form2.Aspx",True) on Button_Click of Form1 but it close the current web form and opened the form2, and when I click on the button on form2 which had Server.Transfer("Form1.Aspx"), the form1 initialized and all the values of form1 controls set to blank, any idea please ? My Form1 has some textboxes and a search...
5
2559
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have start web form and when the user clicks a button (server.transfer) they are directed to the second webform. I was wondering if there is a way to create an instance of the first webform on the second webform? I have a base webform class that both webforms inherit webform1 : BaseWebclass webform2 :BaseWebclass so I do not think I can just inherit webform1 in webform2 thanks --
0
9620
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10104
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.