Re: Preferences Dialog in C#
From: Matt (Matt_at_discussions.microsoft.com)
Date: 01/13/05
- Next message: Mike D: "Simple DropDownList Databound Control"
- Previous message: Willy Denoyette [MVP]: "Re: difference between STA and MTA"
- In reply to: Nick Malik [Microsoft]: "Re: Preferences Dialog in C#"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 13 Jan 2005 13:23:05 -0800
Hi Cor,
Thanks, but just on problem:
Now C# only underlines: axWebBrowser1 with the color blue.
When I build it the error output says:
Error 1 'WEB.Preferences' does not contain a definition for 'axWebBrowser1'
C:\Documents and Settings\Administrator\Desktop\Web Browser\Preferences.cs.
We're getting closer :)
Thanks,
Matt
"Nick Malik [Microsoft]" wrote:
> OK.
>
> In your main form, create a public method. The idea is that any other part
> of the system can call your main form and provide a URL, and your main form
> will respond by bringing up that URL in the window.
>
> Also, I've included the code needed to pass the reference to the preferences
> form.
>
> public class MainForm : System.Windows.Forms.Form
> {
> private Form m_preferences = null;
>
> public void SetURL(string myURL)
> {
> // put code here to cause your browser app to visit the URL and
> render
>
> }
>
> public void DisplayPreferencesDialog()
> {
> m_preferences = new frmPreferences(); // create the preferences
> object
> m_preferences.BrowserWindow = this;
> m_preferences.Show();
>
> }
>
> }
>
> Your preferences window gets one new property and a new method.
>
> public class frmPreferences : System.Windows.Forms.Form
> {
> private MainForm _browserwindow = null;
>
> public MainForm BrowserWindow
> {
> set { _browserwindow = value; }
> }
>
> // now, call this little method from within your form code to set the
> URL on the browser window
> private void SetBrowserWindowURL(string URL)
> {
> _browserwindow.SetURL(URL);
> }
> }
>
> I hope this helps.
> --
> --- Nick Malik [Microsoft]
> MCSD, CFPS, Certified Scrummaster
> http://blogs.msdn.com/nickmalik
>
> Disclaimer: Opinions expressed in this forum are my own, and not
> representative of my employer.
> I do not answer questions on behalf of my employer. I'm just a
> programmer helping programmers.
> --
> "Matt" <Matt@discussions.microsoft.com> wrote in message
> news:97638007-5A1F-4AFB-99F3-90CDAE04F77C@microsoft.com...
> > Hello,
> >
> > Thanks for the help but Im just starting and learning to program in Visual
> > C#. Can you please repeat the instructions in more detail?
> >
> > Thank You,
> >
> > Matt
> >
> > "Nick Malik [Microsoft]" wrote:
> >
> > > when you create the preferences dialog, pass in a reference to the
> browser
> > > object where you have the URL property.
> > > WHen the user clicks the button, assign the new URL to this browser
> object.
> > >
> > >
> > >
> > > --
> > > --- Nick Malik [Microsoft]
> > > MCSD, CFPS, Certified Scrummaster
> > > http://blogs.msdn.com/nickmalik
> > >
> > > Disclaimer: Opinions expressed in this forum are my own, and not
> > > representative of my employer.
> > > I do not answer questions on behalf of my employer. I'm just a
> > > programmer helping programmers.
> > > --
> > > "Matt" <Matt@discussions.microsoft.com> wrote in message
> > > news:6144EF4C-FAC8-493D-B3D3-B98591DAFB2D@microsoft.com...
> > > > Hello,
> > > >
> > > > Im creating a Web Browser in Visual C# and I have a preferences
> dialog.
> > > The
> > > > current homepage is yahoo.com. The code for the homepage is:
> > > >
> > > > // Go Home - go to the default home page.
> > > > WebBrowser thiswebpage = GetCurrentWebBrowser();
> > > > thiswebpage.Navigate("http://www.yahoo.com");
> > > >
> > > > On the preferences dialog I have a section to change the homepage. In
> that
> > > > section I have a text box and a button. The Preferences Dialog is a
> > > seperate
> > > > window. What code should I add to the button so that the homepage
> changes
> > > to
> > > > the website I typed in the text box when the button is clicked?
> > > >
> > > > Thank You,
> > > >
> > > > Matt
> > >
> > >
> > >
>
>
>
- Next message: Mike D: "Simple DropDownList Databound Control"
- Previous message: Willy Denoyette [MVP]: "Re: difference between STA and MTA"
- In reply to: Nick Malik [Microsoft]: "Re: Preferences Dialog in C#"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|