Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 13th, 2005, 12:18 PM
Registered User
 
Join Date: Oct 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Simple 'passing variables between forms' issue...

I'm reasonably new to c# programming and I have a issue which seems like it should be fairly easy to solve, however, I'm getting that 'cant see the wood for the tree's' feeling so hopefully someone can help me here...

I have a simple MDI application that has an 'outlook' style bar on one form and a web control (axWebControl) on another form. What I want to do is pass a URL to the web control when I click an icon on the outlook bar. Problem being that I'm not sure how to pass a variable to the instance the current axWebControl. Can anyone help?

I'm sure I'm missing something obvious and will kick myself when I hear the answer. :)

 
Old October 13th, 2005, 04:25 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Can't you just assign the URL to a property of the web control? i.e. make your own property and then assign it to the current instance of the control.

Jacob.
 
Old October 14th, 2005, 09:13 AM
Registered User
 
Join Date: Oct 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the response Jacob but I'm still having a problem. Here's a better example of where I'm going wrong. I have an MDI application with three forms:-

MDIMain.cs
Browser.cs - (Contains the axWebBrowser object)
ButtonsForm.cs

axWebBrowser is instanciated in the Browser.cs form. Browser.cs also includes this public function:-

public void redirectWeb(string sUrl)
{
try
{
    axWebBrowser1.Visible = true;
    axWebBrowser1.BringToFront();
    System.Object nullObject = 0;
    System.Object nullObjStr = "";
    Cursor.Current = Cursors.WaitCursor;
    axWebBrowser1.Focus();
    axWebBrowser1.Navigate(sUrl, ref nullObject, ref nullObjStr, ref nullObjStr, ref nullObjStr);
    Cursor.Current = Cursors.Default;
}
catch(Exception exc)
{
    MessageBox.Show(exc.Message);
}
}

When I press a button on the ButtonPanel.cs form I would like it to pass a new URL to the current instance of the axWebBrowser control but I'm not sure how to do this. I can get the application to create a new instance of the Browser.cs form each time I click a button but that is not what I want - I need to pass the URL to the [u]current</u> instance of the axWebBrowser.

I'm probably approaching this completely wrong but I need guidance.

Many thanks,

Phil
 
Old October 14th, 2005, 11:12 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It is hard to know what you mean since the terms and concepts used in the description are confusing; e.g. you are talking about files, eventhough it is irrelevant (you probably mean classes). Moreover, axWebBrowser is not a class but an instance of some class, as far as I can see!

In my first post I missed the fact that it was a MDI application. I am not quite sure how to do it. Sorry.

Jacob.
 
Old October 14th, 2005, 02:30 PM
Registered User
 
Join Date: Oct 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

First of all hello,maybe this is not right pleace where i can look for help,but thank you in forward who can help me to build a helpfile AVi files for an application.THANKS AGAIN






Similar Threads
Thread Thread Starter Forum Replies Last Post
Forms - This should be simple. gargamel BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 3 April 10th, 2007 09:16 AM
Passing variables between forms arcuza General .NET 1 July 11th, 2005 09:08 AM
Newbie...probably a simple question...variables IP076 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 2 November 30th, 2004 03:24 PM
Forms and variables Dai Beginning PHP 4 June 19th, 2003 02:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.