473,323 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Cross form communication...

Using VS2005, VB.NET, I have am developing a windows app that has a
login form. This login form can be called by several classes. When the
login form is able to verify that the supplied credentials are valid
then I want to pass an object (System.Net.Credential) back to the
calling/parent class. All the classes that call the login form have a
public property named "_oCredentials" that could be used to store
validated credentials.

My problem is knowing what class opened/called the login form and
getting the code in the form to store the validated credentials back
in the correct parent...

Hope this makes sense. Your input appreciated.

FYI, here is how I am calling the form now (from any of the "parent"
classes)
'Gather domain credentials
Dim frmLogin As New frmDomainLogin
frmLogin.ShowDialog(Me)

Oct 10 '07 #1
4 1941
On Oct 10, 9:56 am, hzgt9b <celof...@gmail.comwrote:
Using VS2005, VB.NET, I have am developing a windows app that has a
login form. This login form can be called by several classes. When the
login form is able to verify that the supplied credentials are valid
then I want to pass an object (System.Net.Credential) back to the
calling/parent class. All the classes that call the login form have a
public property named "_oCredentials" that could be used to store
validated credentials.

My problem is knowing what class opened/called the login form and
getting the code in the form to store the validated credentials back
in the correct parent...

Hope this makes sense. Your input appreciated.

FYI, here is how I am calling the form now (from any of the "parent"
classes)
'Gather domain credentials
Dim frmLogin As New frmDomainLogin
frmLogin.ShowDialog(Me)
You could create a interface for all your parent forms to implement.
Call it something like iCallTheLoginForm or whatever is appropriate.
Then in your login form you can reference the parent form by casting
it to your interface.

Public Interface iCallTheLoginForm
Public Property LoginCredential as System.Net.Credential
End Interface

Public Class MainForm
implements iCallTheLoginForm

Public Property MainForm_LoginCredential As System.Net.Credential
Implements iCallTheLoginForm.LoginCredential

.....

Public Class LoginForm

Private myParent as iCallTheLoginForm

Public Sub New(p as iCallTheLoginForm)
myParent = p
End Sub

.....
That should be a good start, I quick typed that one, so it might have
a typo...

Oct 10 '07 #2
You could create a interface for all your parent forms to implement.
Call it something like iCallTheLoginForm or whatever is appropriate.
Then in your login form you can reference the parent form by casting
it to your interface.

Public Interface iCallTheLoginForm
Public Property LoginCredential as System.Net.Credential
End Interface
Thanks for the quick response... unfortunately I am unable to declare
a property of type "System.Net.Credential" as the return type in the
interface (even after importing System.Net)...

Oct 10 '07 #3
what i usually do in this situation, is overload the ShowDialog function wiht
my own return type, then do the base form's showdialog then return the
info....ex

Public Overloads Function ShowDialog() As String

MyBase.ShowDialog()

Return String.Empty

End Function

and there ya go. hope this helps
--
-iwdu15
Oct 10 '07 #4
Thanks, I implemented an interface and then did the case back to the
form... works great.

Oct 12 '07 #5

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

Similar topics

1
by: MatthewRoberts | last post by:
Howdy All, I am having difficulty with two-way communication across AppDomains in an attempt to dynamically script applications. Everything works as expected, except when using ByRef parameters....
7
by: Urs Vogel | last post by:
Hi For my application server, I had to overcome some limitations in older COM-database drivers, whers sessions per driver instance are limited. Instantiating the COM component several times does...
1
by: Modica82 | last post by:
Hi all, I have been trying to find a way to send a PDF from my web service. I have had the idea of sending back a byte array, but to be honest the efficiency issue is there and i would like to...
4
by: Jacob JKW | last post by:
Having read the CLJ FAQ and having done extensive Googling, I do understand that in in general cross-domain iframe scripting is not permitted. One issue I have not seen directly addressed, however,...
1
by: NagarajanS | last post by:
hi, i have a problem in cross thread communication.my problem is i drog some controls in the form.now i created new thread inside the coding of form.cs.when i try to run that thread it shows the...
0
by: zb | last post by:
Here is the page architecture: Page loads multiple user controls (including nested user controls) dynamically based on parameters provided into place holders. Note: The page only has the logic to...
13
by: Jeff | last post by:
We have an intranet website that currently uses ActiveX but we need to make it cross-browser compatible and also get around the problems we've been having with making it work with IE7 and Vista. We...
1
by: pankaj17 | last post by:
hello , Cross-Domain Communication Between IFrames in this script they have included 2 iframes. parent can send a message to both iframes and frames can send massage to each other. they have...
3
by: hash4sp | last post by:
Hello Can anyone here please guide me with the Cross Domain Communication between IFrames. Problem: Application1 running on IIS => http://localhost.ad.local/Applicaiton1 Application2...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.