Hi,
I've got a few questions relating to C# (Forms & Code) and am hoping that someone could please help. If you do, it'll be much appreciated.
- Is it possible to add tabs (like MS VS does) when I want to make a new thing If so, what do I do
- Is is possible, to add non-existant programs to a menu after they have been installed on a computer (like MS Windows Start Menu etc. or Internet Explorer) If so, what do I do
- When printing with web browsers, is it possible to NOT use the image document user (like when using IE) If so, what do I do
- Is it posssible to ban websites using web browsers If so, what do I do
- Is it possible to have a loading bar when a web browser is loading or if something is printing If so, what do I do
- Is it possible to have a <Back and Forward> button like in IE and Windows Explorer If so, what do I do
- Is it possible to have text size & encoding in web browser menus If so, what do I do
These questions were gathered over a period of time so that only one forum post would be used and so I don't have too many posts all over the place.
Thanks,
Eragon.

Many a C# Question
praveench2k
HeatherLK
Form1.Dispose();
Otherwise
this.ShowInTaskbar = false;
Form1.Hide();
yudkovsky
Hi,
I have gathered pleanty of more questions and am going to publush them here instead of putting them in another post, due to space and time:
Thank you for your first support, and I hope that these and the previous questions will help many people.
Thanks,
Eragon.
Andy Britcliffe
1) yes it is. How Not sure. Take a look at the TabControl component - I've never worked with it so can't comment on that :-)
2) Well if you deploy it using say the standard Windows setup and deployment project then you have a feature to create a shortcut in the start menu. Not sure about ClickOnce if it does this or not. Programmatically in code you can but requires the use of IWshRuntme library.
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=673469&SiteID=1
4) not sure but I would invest in network security/proxy server/website filtering software as it would be much easier than making your own
5) yes it is. The webbrowser control has a progressChanged event which you can implement and show the progress. It will fire when the progress has been changed of loading a document.
The WebBrowserProgressChangedEventArgs gives you 2 properties. The CurrentProgress of the page and the MaximumProgress, which will get you the total number of bytes loaded (long data type)
http://msdn2.microsoft.com/en-us/library/system.windows.forms.webbrowser.progresschanged.aspx
6) indeed it is. Place a back button for example and use the webbrowser's GoBack() method. This will look in the history and go back. Also use GoForward() method to...go forward ;-)
I hope this has helped you in some way
Jeff Williams
hi,
I'm not sure I understand that, but thanks anyway, but I'd mainly like the first question answered as it is the most vital one to the application i'm making.
thanks,
Eragon.
Sameep
Hi,
What are you talking about
Thanks,
Eragon.
Benedikt
Yes. That is what I'd like to know about. Is it possible or was IE7 not created with MS's own software developing tool
Thanks,
Eragon.
Brian Hsi - MSFT
//*************************** Tab Controls ****************************//
private void Create_a_new_tab()
{
TabPage newpage = new TabPage("Loading...");
tabpages.Add(newpage);
tabControl1.TabPages.Add(newpage);
if (current_tab_count == 10) return;
WebBrowser webpage = new WebBrowser();
webpage.ProgressChanged += new WebBrowserProgressChangedEventHandler(webpage_ProssesChanged);
webpage.Parent = newpage;
webpage.Dock = DockStyle.Fill;
webpages.Add(webpage);
webpage.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webpage_DocumentCompleted);
webpage.Navigate(HomePage);
tabControl1.SelectedTab = newpage;
}
void webpage_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
UpdateAllNames();
comboBoxurl.Text = e.Url.ToString();
ModifyNavigationButtons();
}
private WebBrowser GetCurrentWebBrowser()
{
TabPage current_tab = tabControl1.SelectedTab;
WebBrowser thiswebpage = (WebBrowser)webpages[tabpages.IndexOf(current_tab)];
return thiswebpage;
}
private void UpdateName(TabPage tb)
{
TabPage current_tab = tb;
WebBrowser thiswebpage = (WebBrowser)webpages[tabpages.IndexOf(current_tab)];
if (thiswebpage.Document != null)
current_tab.Text = thiswebpage.Document.Title;
else
current_tab.Text = "Zzz";
}
private void UpdateAllNames()
{
// Update all the tab names for all the currently open web pages.
foreach (TabPage tb in tabControl1.TabPages)
{
UpdateName(tb);
}
}
and if you want the status bar to work with this then :
private void webpage_ProssesChanged(object sender, WebBrowserProgressChangedEventArgs e)
{
WebBrowser thiswebpage = GetCurrentWebBrowser();
WebBrowser item = sender as WebBrowser;
/* The CurrentProgress variable from the raised event
* gives you the current number of bytes already downloaded
* while the MaximumProgress is the total number of bytes
* to be downloaded */
if (e.CurrentProgress < e.MaximumProgress)
{
// Check if the current progress in the progress bar
// is >= to the maximum if yes reset it with the min
if (pbStatus.Value >= pbStatus.Maximum)
pbStatus.Value = pbStatus.Minimum;
else
// Just increase the progress bar
pbStatus.PerformStep();
}
else
// When the document is fully downloaded
// reset the progress bar to the min (0)
pbStatus.Value = pbStatus.Minimum;
}
I hope this is what your looking for,
Simon
stallion_alpa
I'm sure the first question's response is using a TabControl component. Take a look at this and see if it helps:
http://www.c-sharpcorner.com/Code/2003/Dec/TabControlTutorial.asp
http://www.c-sharpcorner.com/Tutorials/WorkingWithTabControlP1.asp
AlucardHellSing
well the code in the link supplied gives you what you need :-)
you just need to implement the event. click on the webbrowser control and view its properties. Then view its events and double click the progressChanged event. From there just look at the e.CurrentProgress and that's it. The documentation also provides an example I believe
FrankLi
Peter Aspect
hi,
sorry to say, but only number 6 was the helpful one but the no. 5 could be more helpful if you specify the code.
thanks.
Eragon.