473,835 Members | 2,203 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Preferences Dialog in C#

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 = GetCurrentWebBr owser();
thiswebpage.Nav igate("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
Nov 16 '05 #1
13 2243
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" <Ma**@discussio ns.microsoft.co m> wrote in message
news:61******** *************** ***********@mic rosoft.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 = GetCurrentWebBr owser();
thiswebpage.Nav igate("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

Nov 16 '05 #2
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" <Ma**@discussio ns.microsoft.co m> wrote in message
news:61******** *************** ***********@mic rosoft.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 = GetCurrentWebBr owser();
thiswebpage.Nav igate("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


Nov 16 '05 #3

You can't really do that within the constraints of a VS setup project.
You
could reduct the number of MSI files by combining some of the generic
setups
into one setup, but each web setup is a separate MSI file. There are
other
tools that can what you want (which is what InstallShield, Wise,
ZeroG,
AdvancedInstall er etc do)
Detect FrameWork
http://blogs.msdn.com/astebner/archi...14/229574.aspx
Setup Bootstrapper
http://www.codeproject.com/dotnet/dotNetInstaller.asp
On Wed, 12 Jan 2005 19:37:05 -0800, "Matt"
<Ma**@discussio ns.microsoft.co m> wrote:
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" <Ma**@discussio ns.microsoft.co m> wrote in message
news:61******** *************** ***********@mic rosoft.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 = GetCurrentWebBr owser();
> thiswebpage.Nav igate("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



Nov 16 '05 #4
huh?

--
--- 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.
--
"Laurent Liegeois" <zo****@lli.b e> wrote in message
news:vp******** *************** *********@4ax.c om...

You can't really do that within the constraints of a VS setup project.
You
could reduct the number of MSI files by combining some of the generic
setups
into one setup, but each web setup is a separate MSI file. There are
other
tools that can what you want (which is what InstallShield, Wise,
ZeroG,
AdvancedInstall er etc do)
Detect FrameWork
http://blogs.msdn.com/astebner/archi...14/229574.aspx
Setup Bootstrapper
http://www.codeproject.com/dotnet/dotNetInstaller.asp
On Wed, 12 Jan 2005 19:37:05 -0800, "Matt"
<Ma**@discussio ns.microsoft.co m> wrote:
Hello,

Thanks for the help but Im just starting and learning to program in VisualC#. 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" <Ma**@discussio ns.microsoft.co m> wrote in message
news:61******** *************** ***********@mic rosoft.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 = GetCurrentWebBr owser();
> thiswebpage.Nav igate("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

Nov 16 '05 #5
Matt,

I think you are after this piece of code

AxWebBrowser.Na vigate("about:< html><body
onload=javascri pt:window.exter nal.addFavorite ('" + textbox1.Text +
"')></body></html>")

I hope this helps?

Cor
Nov 16 '05 #6
Hi Cor,

No, it's not that. Visual C# underlines many parts of the code red. And it
doesn't work.

Thanks anyways,

Matt

"Cor Ligthert" wrote:
Matt,

I think you are after this piece of code

AxWebBrowser.Na vigate("about:< html><body
onload=javascri pt:window.exter nal.addFavorite ('" + textbox1.Text +
"')></body></html>")

I hope this helps?

Cor

Nov 16 '05 #7
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 DisplayPreferen cesDialog()
{
m_preferences = new frmPreferences( ); // create the preferences
object
m_preferences.B rowserWindow = this;
m_preferences.S how();

}

}

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 SetBrowserWindo wURL(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" <Ma**@discussio ns.microsoft.co m> wrote in message
news:97******** *************** ***********@mic rosoft.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" <Ma**@discussio ns.microsoft.co m> wrote in message
news:61******** *************** ***********@mic rosoft.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 = GetCurrentWebBr owser();
thiswebpage.Nav igate("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


Nov 16 '05 #8
Matt,

A little bit copied to fast from VBNet
this.axWebBrows er1.Navigate(@" about:<html><bo dy
onload=javascri pt:window.exter nal.addFavorite ('http://www.Google.com' )></body></html>");

I this goes better?

Cor
Nov 16 '05 #9
Hi Cor,

Thanks, but just on problem:

Now C# only underlines: axWebBrowser1 with the color blue.

When I build it the error output says:

'WEB.Preference s' does not contain a definition for 'axWebBrowser1'
C:\Documents and Settings\Admini strator\Desktop \Web Browser\Prefere nces.cs.

We're getting closer :)

Thanks,

Matt

"Cor Ligthert" wrote:
Matt,

A little bit copied to fast from VBNet
this.axWebBrows er1.Navigate(@" about:<html><bo dy
onload=javascri pt:window.exter nal.addFavorite ('http://www.Google.com' )></body></html>");

I this goes better?

Cor

Nov 16 '05 #10

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

Similar topics

0
1858
by: Adam J. Schaff | last post by:
OK, there are billions of posts on dotnet newsgroups about this, and I have read half of them, but I'm still a little confused. First I'll say what I think I've learned and anyone can correct me if I'm off target. 1. User preferences should be saved to the UserAppDataPath. 2. They should be saved as an XML file. 3. Serialization is a handy technology for going about this, since you can simply store all your preferences in an object and...
3
1075
by: Jonathan | last post by:
Hi, Here's an interesting challenge for anyone who's up to it. :-) When I edit preferences for Netscape or Mozilla, there's an option that says "block unrequested popup windows." Next to this is a button that says "Allowed Sites." Presumably, the idea is that if you have a serious web application that needs to open new browser windows, you might want to tell your clients to add you to the "Allowed Sites." Well...when I look at the...
0
2019
by: Just Me | last post by:
If I look at the properties of a printer I can find two things: Printing Preferences and Printing Defaults. I believe the preferences apply to my apps and the defaults apply to all users. In a dotnet app: Which does the DefaultPageSetting relate to?
3
2417
by: clintonG | last post by:
I'm messing around with the Request.UserLanguages and the Request.ServerVariables("HTTP_ACCEPT_LANGUAGE"); to see how similar or dissimilar they may be. I observe and conclude that both get their value from the Accept-Language key stored in the header of the response. To test this hypothesis I reconfigure IE Language Preferences which by default (for me) is English (United States). I include a Spanish (Mexico) Language Preference and
0
975
by: Tom | last post by:
I am planning on adding a Preferences form to my application and using the Property Grid to display the preferences to the user. What do you think would be the best way to save these preferences out to an XML file? Use the CAB (Configuration Application Block)? Save the preferences in a class object and serialize them out the the XML file? Write them out directly to the XML file? Other ways??? Just want to get some thoughts together......
11
2439
by: Tom | last post by:
I am planning on adding a Preferences form to my application and using the Property Grid to display the preferences to the user. What do you think would be the best way to save these preferences out to an XML file? Use the CAB (Configuration Application Block)? Save the preferences in a class object and serialize them out the the XML file? Write them out directly to the XML file? Other ways??? Just want to get some thoughts together......
1
1637
by: Tom | last post by:
I have a large application; lots of forms, multiple dynamic DLLs, etc. I also have, in the appliation, a general 'Preferences' class object (which is in itself a separate DLL, and I just include a reference to it so I can instantiate it at the beginning) which stores all my user preferences. I serialize the data to and from an XML file, thereby saving and restoring the user preferences with ease. I also have a Preferences form that the user...
0
1088
by: H. Williams | last post by:
I am trying to programmatically change printing preferences (not printer settings). For example, preferences specific to a printer like watermark or pages per sheet. I have tried using the PrintDocument.PrinterSettings class, but it only exposes the basic printer settings. I have been able to use SystemManagement.ManagementObject.Properties to expose additional printer settings, but I can't seem to find the preferences. Anyone know how...
1
8778
by: =?Utf-8?B?T21lZ2FTcXVhcmVk?= | last post by:
have customized PageSetup and Print dialogs that emulate the standard dialogs. I would like to be able to open the "Printer Preferences" dialog by clicking a button (just like can be done on the standard dialogs). (On some Print dialogs (such as in Word and Excel) this button is labelled "Properties". And just to avoid being too consistent, it is labelled "Options" on the Excel PageSetup dialog.) I thought that this would be trivial,...
0
10815
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10524
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...
0
9348
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...
1
7768
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5639
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
5805
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4434
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
2
3997
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3092
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.